replacing a substring of a string with another string
How can I use string.replace() to do something like:
Code:
string str, str2, str3;
str = "an adequate amount of text";
str2 = "amount of ";
st3 = "";
str.replace(str2, str3); // an adequate text
//or
str = "an adequate amount of text";
str3 = "[how did this get here?]";
str.replace(str2, str3); // an adequate [how did this get here?] text
From looking at the documentation, it seems that replace() will not replace more than the amount of text it's replacing.