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

 

jebbert@volusia.k12.fl.us > crazyBuildString
prev  |  next  |  chance

Write a method that accepts a string as an input parameter and returns the string in reverse order with dashes between each character in the string. Do NOT put a dash at the beginning or end of the string. Look at the test data for examples. When writing this method, the only string mehtods you may use are: .length .substring .charAt .equals NOTE: It is possible to do the body of this entire method in one relatively clean line of code, so don't overcomplicate things!


crazyBuildString("testing") → "g-n-i-t-s-e-t"
crazyBuildString("run for the hills") → "s-l-l-i-h- -e-h-t- -r-o-f- -n-u-r"
crazyBuildString("x") → "x"

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

public String crazyBuildString(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: 310

Copyright Nick Parlante 2017 - privacy