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

 

foldInHalf


Return a new string where the first half of the characters are swapped with the second half of the characters while keeping the middle character in the middle. For example if the given str is "TodayIsn'tWindy", get the first half which is "TodayIs", then get the second half which is "'tWindy" and return a new string as "'tWindynTodayIs", and n stays in the middle


foldInHalf("") → ""
foldInHalf("1") → "1"
foldInHalf("e%!") → "!%e"

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

public String foldInHalf(String str) { }

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: 105 Post-solution available

Copyright Nick Parlante 2017 - privacy