Fixed the searchAndReplace function so that it correctly skips over the newly inserted replacement strings.
This commit is contained in:
parent
6c94ea13eb
commit
960f20fe1e
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user