helpers: add trim methodes for left and right trim

Origin commit data
------------------
Commit: 5e1b9aaa4d
Author: Thilo Graf <dbt@novatux.de>
Date: 2019-03-28 (Thu, 28 Mar 2019)
This commit is contained in:
2019-03-28 20:55:49 +01:00
committed by vanhofen
parent 70a4e3610f
commit 510da5d8de
2 changed files with 15 additions and 1 deletions

View File

@@ -613,6 +613,18 @@ std::string trim(std::string &str, const std::string &trimChars /*= " \n\r\t"*/)
return result.erase(0, result.find_first_not_of(trimChars));
}
std::string ltrim(std::string& str, const std::string& trimChars)
{
str.erase(0, str.find_first_not_of(trimChars));
return str;
}
std::string rtrim(std::string& str, const std::string& trimChars)
{
str.erase(str.find_last_not_of(trimChars) + 1);
return str;
}
std::string cutString(const std::string str, int msgFont, const int width)
{
Font *msgFont_ = g_Font[msgFont];