StringUtil: StringPopBackIf added

This commit is contained in:
Sepalani
2017-06-06 05:08:51 +01:00
parent 1209959012
commit f28f23af1d
3 changed files with 13 additions and 8 deletions

View File

@ -405,6 +405,12 @@ bool StringEndsWith(const std::string& str, const std::string& end)
return str.size() >= end.size() && std::equal(end.rbegin(), end.rend(), str.rbegin());
}
void StringPopBackIf(std::string* s, char c)
{
if (!s->empty() && s->back() == c)
s->pop_back();
}
#ifdef _WIN32
std::string UTF16ToUTF8(const std::wstring& input)