Fixed the searchAndReplace function so that it correctly skips over the newly inserted replacement strings.

This commit is contained in:
Robert Osfield 2011-05-27 11:07:04 +00:00
parent 6c94ea13eb
commit 960f20fe1e

View File

@ -14,6 +14,7 @@ void searchAndReplace(std::string& str, const std::string& spat, const std::stri
while ((pos = str.find(spat, pos)) != std::string::npos) while ((pos = str.find(spat, pos)) != std::string::npos)
{ {
str.replace(pos, spat.length(), rpat); str.replace(pos, spat.length(), rpat);
pos += rpat.length();
} }
} }