|
- #pragma once
-
- std::string Replace(std::string str, const std::string& strToFind, const std::string& replaceWith) {
- size_t index = 0;
- std::string result = str;
- while (true) {
- index = result.find(strToFind, index);
- if (index == std::string::npos)
- break;
- result.replace(index, strToFind.size(), replaceWith);
- index += replaceWith.size();
- }
- return result;
- }
|