Last active
August 29, 2015 14:13
-
-
Save rozzy/d3383dc4e2023de5e818 to your computer and use it in GitHub Desktop.
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
void replace_string_in_place(std::string& subject, const std::string& search, | |
const std::string& replace) { | |
size_t pos = 0; | |
while ((pos = subject.find(search, pos)) != std::string::npos) { | |
subject.replace(pos, search.length(), replace); | |
pos += replace.length(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment