From: Maxim Mamontov Date: Sat, 10 Jan 2015 19:43:52 +0000 (+0200) Subject: Added ToLower/ToUpper. X-Git-Tag: 2.409~226 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/b91e9676639abcb81181f036923c44d4a71c251a Added ToLower/ToUpper. --- diff --git a/stglibs/common.lib/common.cpp b/stglibs/common.lib/common.cpp index 1068cfa1..8c3eb1a5 100644 --- a/stglibs/common.lib/common.cpp +++ b/stglibs/common.lib/common.cpp @@ -820,6 +820,18 @@ std::string & Trim(std::string & val) return TrimR(TrimL(val)); } //--------------------------------------------------------------------------- +std::string ToLower(std::string value) +{ + std::transform(value.begin(), value.end(), value.begin(), ::tolower); + return value; +} +//--------------------------------------------------------------------------- +std::string ToUpper(std::string value) +{ + std::transform(value.begin(), value.end(), value.begin(), ::toupper); + return value; +} +//--------------------------------------------------------------------------- #ifdef WIN32 static int is_leap(unsigned y) { diff --git a/stglibs/common.lib/include/stg/common.h b/stglibs/common.lib/include/stg/common.h index fe3b3af2..e2eb0d58 100644 --- a/stglibs/common.lib/include/stg/common.h +++ b/stglibs/common.lib/include/stg/common.h @@ -97,6 +97,9 @@ std::string & TrimL(std::string & val); std::string & TrimR(std::string & val); std::string & Trim(std::string & val); +std::string ToLower(std::string value); +std::string ToUpper(std::string value); + template C Split(const std::string & value, char delim, F conv) {