added string functions

This commit is contained in:
2021-03-28 13:42:53 +02:00
parent 337fb2f80d
commit 89dd5c6f07
6 changed files with 45 additions and 8 deletions

View File

@@ -43,7 +43,17 @@ std::vector<std::string> regexp_strsplit(const std::string &string_to_split, con
return elems;
}
std::string trim(std::string s, const std::string &chars_to_trim, const std::string &rltrim) {
std::string string_lucase(std::string s, const std::string &strcase) {
if (strcase == "upper")
std::transform(s.begin(), s.end(),s.begin(), ::toupper);
if (strcase == "lower")
std::transform(s.begin(), s.end(),s.begin(), ::tolower);
return s;
}
std::string string_trim(std::string s, const std::string &chars_to_trim, const std::string &rltrim) {
if (rltrim == "ltrim" || rltrim == "trim")
s.erase(0, s.find_first_not_of(chars_to_trim));