+
+String
+String::substitute (String find, String replace)
+{
+ int n = find.length ();
+ int m = replace.length ();
+ for (int i = index (find), j = 0; i > -1;
+ i = right_string (length () - j).index (find))
+ {
+ *this = left_string (i + j)
+ + replace
+ + right_string (length () - j - i - n);
+ j += i + m;
+ }
+ return *this;
+}
+
+String
+String::substitute (char find, char replace)
+{
+ for (int i = index (find); i > - 1; i = index (find))
+ (*this)[i] = replace;
+ return *this;
+}