Implement a program that given three strings
c, substitutes all instances of the substring
In other words, implement Ruby's
String#gsub with strings instead of regexes (
a.gsub b, c).
- Standard loopholes apply.
- You may not use a builtin that performs this exact task.
- This is code-golf, shortest answer wins.
Not a duplicate of this challenge.
sub("test 1 test 1 test 1", "1", "what") --> "test what test what test what"