From b91e9676639abcb81181f036923c44d4a71c251a Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Sat, 10 Jan 2015 21:43:52 +0200 Subject: [PATCH] Added ToLower/ToUpper. --- stglibs/common.lib/common.cpp | 12 ++++++++++++ stglibs/common.lib/include/stg/common.h | 3 +++ 2 files changed, 15 insertions(+) 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) { -- 2.43.2