about | help | code help+videos | done | prefs |
Write a method that returns the string 'str' but with alternating capitalization. It doesn't matter what capitalization 'str' starts out with. You must return 'str' with the first letter capitalized, the next letter lower case, then capitalized, then lower case, then capitalized, etc. Do not change any special symbols or characters, but they DO count as part of the alternating. So "Hi there!" becomes "Hi tHeRe!". The space WOULD have been capitalized, except that it is not a letter so it was left unchanged. Remember that you can use the .toUpperCase and .toLowerCase methods on strings or substrings. Look at the test data for examples. test2021_11_18_APSLHL_altCase("") → "" test2021_11_18_APSLHL_altCase("x") → "X" test2021_11_18_APSLHL_altCase("Y") → "Y" ...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: 240
Copyright Nick Parlante 2017 - privacy