about | help | code help+videos | done | prefs |
Write a method that returns the character at a specific position 'pos' in the string 'str'. For example, if 'str' was "Wonderful" and 'pos' was 3, you would return "d" because that is the character in position 3. Remember that the character positions in strings start at zero, which is why "d" is at position 3. If 'pos' indicates a position beyond the end of the string 'str', you simply return "none" to say that there is no character in that position. As a precondition you may assume that 'pos' is not negative. The string 'str' can be any length. It can even be an empty string! Look at the test data for examples. test2022_10_13_APP1SLHL_getSpecificCharacter("", 1) → "none" test2022_10_13_APP1SLHL_getSpecificCharacter("", 0) → "none" test2022_10_13_APP1SLHL_getSpecificCharacter("Eat healthy food!", 16) → "!" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 210
Copyright Nick Parlante 2017 - privacy