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

Java > String-2 > repeatSeparator
prev  |  next  |  chance

Given two strings, word and a separator, return a big string made of count occurences of the word, separated by the separator string.

repeatSeparator("Word", "X", 3) → "WordXWordXWord"
repeatSeparator("This", "And", 2) → "ThisAndThis"
repeatSeparator("This", "And", 1) → "This"

...Save, Compile, Run

See also Java Example Code. Java help docs: If Boolean Logic | Strings | While and For Loops | Arrays and Loops


prev  |  next  |  chance   |  CodingBat  >  String-2

Forget It! -- delete my code for this problem 236.0

Copyright Nick Parlante 2006-10 - privacy