Merge pull request #664 from Dmitry-Me/fixSerachReplace2

Further fix search replace
This commit is contained in:
PKEuS 2015-09-03 11:18:19 +02:00
commit ea11e28ea3
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();
}
}