Further fix search replace

This commit is contained in:
Dmitry-Me 2015-09-02 17:06:19 +03:00
parent 89c4e08fc4
commit cdf1521258
1 changed files with 1 additions and 8 deletions

View File

@ -302,14 +302,7 @@ void ErrorLogger::ErrorMessage::findAndReplace(std::string &source, const std::s
std::string::size_type index = 0;
while ((index = source.find(searchFor, index)) != std::string::npos) {
source.replace(index, searchFor.length(), replaceWith);
std::string::size_type advanceBy;
if (searchFor.length() >= replaceWith.length())
advanceBy = replaceWith.length();
else
advanceBy = (replaceWith.length() - searchFor.length()) + 1;
index += advanceBy;
index += replaceWith.length();
}
}