id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

changeOddChars


Given a string str and a boolean value odd, create a new string and change all characters located at odd indices to uppercase and characters located at even indices to lowercase, if the parameter odd is true.
If the odd parameter is false, all characters located at odd indices should change to lowercase and the rest to uppercase.


changeOddChars("ab", true) → "aB"
changeOddChars("aaaaa", true) → "aAaAa"
changeOddChars("ABcsde", true) → "aBcSdE"

...Save, Compile, Run (ctrl-enter)

public String changeOddChars(String str, boolean odd) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 110

Copyright Nick Parlante 2017 - privacy