6 kyu

replaceAll(input, find, replace)

675 of 775wthit56

Description:

Isn't it annoying how "string".replace("find", "replace"); only replaces the first match of the find string? Write a function, replaceAll(input, find, replace); that will replace all matches of the given find string with the given replace string.

The function will always be called with three strings, so don't worry about validating the arguments.

As with the original "string".replace(find, replace), if find is an empty string, it should match in-between each character, effectively inserting replace in-between each character, including the start and end of the string. I've given you some tests for this to make it a little clearer.

Strings
Regular Expressions
Algorithms

Stats:

CreatedDec 13, 2013
PublishedDec 15, 2013
Warriors Trained1355
Total Skips31
Total Code Submissions6719
Total Times Completed775
JavaScript Completions675
C# Completions97
Total Stars22
% of votes with a positive feedback rating85% of 192
Total "Very Satisfied" Votes147
Total "Somewhat Satisfied" Votes31
Total "Not Satisfied" Votes14
Total Rank Assessments6
Average Assessed Rank
5 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • wthit56 Avatar
  • jhoffner Avatar
  • user5036852 Avatar
  • hobovsky Avatar
Ad