FIX: config: fix a endless loop issue when replace string
jira: STUDIO-7545 Change-Id: I7ea06556142242f44b183599d9d23d063ad509f9 (cherry picked from commit 842e238d6265abb34f33614c255d1292c3345c34)
This commit is contained in:
parent
f402685aee
commit
0cfa60b657
|
@ -38,7 +38,12 @@ std::set<std::string> SplitStringAndRemoveDuplicateElement(const std::string &st
|
||||||
void ReplaceString(std::string &resource_str, const std::string &old_str, const std::string &new_str)
|
void ReplaceString(std::string &resource_str, const std::string &old_str, const std::string &new_str)
|
||||||
{
|
{
|
||||||
std::string::size_type pos = 0;
|
std::string::size_type pos = 0;
|
||||||
while ((pos = resource_str.find(old_str)) != std::string::npos) { resource_str.replace(pos, old_str.length(), new_str); }
|
size_t new_size = 0;
|
||||||
|
while ((pos = resource_str.find(old_str, pos + new_size)) != std::string::npos)
|
||||||
|
{
|
||||||
|
resource_str.replace(pos, old_str.length(), new_str);
|
||||||
|
new_size = new_str.size();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue