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:
Lioncash committed 2014-12-08 14:07:53 -05:00
1 parent e7dff5aaab
commit 60f8132d2e
1 file changed
+4
+4
View File
@@ -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);