Last active
May 30, 2017 20:15
-
-
Save dima74/64a90035aeed0f5fc754279b03b8d313 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 replaceAll(string &source, string search, string replace) { | |
size_t position = 0; | |
while ((position = source.find(search, position)) != string::npos) { | |
source.replace(position, search.length(), replace); | |
position += replace.length(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment