Created
August 2, 2022 14:42
-
-
Save CoGrammarCodeReview/d49c837f7b170b8a6c6fdcd5170e4e91 to your computer and use it in GitHub Desktop.
String Challenge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create a function that, given a string with at least three characters, returns an array of its: | |
Length. | |
First character. | |
Last character. | |
Middle character, if the string has an odd number of characters. Middle TWO characters, if the string has an even number of characters. | |
Index of the second occurrence of the second character in the format "@ index #" and "not found" if the second character | |
doesn't occur again. | |
Examples | |
allAboutStrings("LASA") ➞ [4, "L", "A", "AS", "@ index 3"] | |
allAboutStrings("Computer") ➞ [8, "C", "r", "pu", "not found"] | |
allAboutStrings("Science") ➞ [7, "S", "e", "e", "@ index 5"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment