mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
stringutil: Add early-exit case to ReplaceAll
If both 'replaceands' are the same, the result string can just be returned.
This commit is contained in:
1 parent
e7dff5aaab
commit
60f8132d2e
1 file changed
+4
@@ -230,6 +230,10 @@ void SplitString(const std::string& str, const char delim, std::vector<std::stri
|
||||
std::string ReplaceAll(std::string result, const std::string& src, const std::string& dest)
|
||||
{
|
||||
size_t pos = 0;
|
||||
|
||||
if (src == dest)
|
||||
return result;
|
||||
|
||||
while(1)
|
||||
{
|
||||
pos = result.find(src, pos);
|
||||
|
||||
Reference in new issue
Block a user