Created
May 17, 2015 20:55
-
-
Save syuhari/4fab863c37da595f049c to your computer and use it in GitHub Desktop.
string 文字列の中にある指定の文字列を繰り返し置換する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::string replaceString(std::string string1, std::string string2, std::string string3) | |
{ | |
std::string::size_type pos(string1.find(string2)); | |
while(pos!=std::string::npos) { | |
string1.replace(pos, string2.length(), string3); | |
pos = string1.find(string2, pos + string3.length()); | |
} | |
return string1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment