6 kyu
replaceAll(input, find, replace)
674 of 774wthit56
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
Similar Kata:
Stats:
Created | Dec 13, 2013 |
Published | Dec 15, 2013 |
Warriors Trained | 1347 |
Total Skips | 31 |
Total Code Submissions | 6705 |
Total Times Completed | 774 |
JavaScript Completions | 674 |
C# Completions | 97 |
Total Stars | 22 |
% of votes with a positive feedback rating | 85% of 192 |
Total "Very Satisfied" Votes | 147 |
Total "Somewhat Satisfied" Votes | 31 |
Total "Not Satisfied" Votes | 14 |
Total Rank Assessments | 6 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |