Further fix search replace
This commit is contained in:
parent
89c4e08fc4
commit
cdf1521258
|
@ -302,14 +302,7 @@ void ErrorLogger::ErrorMessage::findAndReplace(std::string &source, const std::s
|
||||||
std::string::size_type index = 0;
|
std::string::size_type index = 0;
|
||||||
while ((index = source.find(searchFor, index)) != std::string::npos) {
|
while ((index = source.find(searchFor, index)) != std::string::npos) {
|
||||||
source.replace(index, searchFor.length(), replaceWith);
|
source.replace(index, searchFor.length(), replaceWith);
|
||||||
|
index += replaceWith.length();
|
||||||
std::string::size_type advanceBy;
|
|
||||||
if (searchFor.length() >= replaceWith.length())
|
|
||||||
advanceBy = replaceWith.length();
|
|
||||||
else
|
|
||||||
advanceBy = (replaceWith.length() - searchFor.length()) + 1;
|
|
||||||
|
|
||||||
index += advanceBy;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue