Welcome back to another fantastic Monday!
Today's objective is to write a method that takes a given string and replaces all occurrences of that string with another string and returns the number of replacements made. For instance, given the string "problem of the day" and a replacement value of " ", the final result would be "problem-of-the-day" with a return value of 3. If your language of choice doesn't support pass by reference of strings feel free to return multiple values.
Comments:
Nick Krichevsky - 10 years, 6 months ago
C++ solution using the magic of pointers!
reply permalink
Anonymous - 10 years, 6 months ago
reply permalink
Mre64 - 10 years, 6 months ago
/* Mre64 6/16/14
*/ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections;
public class ReplaceString {
}
reply permalink
Anonymous - 10 years, 6 months ago
reply permalink