minor bug

This commit is contained in:
heisenbuug
2021-10-26 13:26:30 +05:30
parent d986e3dc3b
commit 5cade8d337
+8 -3
View File
@@ -41,9 +41,12 @@ inline void Trim(std::string& str)
while (std::isspace(str[endIndex]))
endIndex--;
std::string trimmedStr = (endIndex - startIndex == str.size()) ?
std::move(str) : str.substr(startIndex,
endIndex - startIndex + 1);
std::string trimmedStr;
if (endIndex - startIndex == str.size())
trimmedStr = std::move(str);
else
trimmedStr = str.substr(startIndex, endIndex - startIndex + 1);
str = trimmedStr;
}
@@ -88,6 +91,8 @@ inline void TrimIf(std::string &str, std::function<bool(char)> func)
break;
}
std::string trimmedStr;
if (endIndex - startIndex == str.size())
trimmedStr = std::move(str);
else