diff options
Diffstat (limited to 'src/StringUtils.cpp')
-rw-r--r-- | src/StringUtils.cpp | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp index decce8065..0e30e8ebb 100644 --- a/src/StringUtils.cpp +++ b/src/StringUtils.cpp @@ -198,14 +198,7 @@ AString TrimString(const AString & str) AString & StrToUpper(AString & s) { - AString::iterator i = s.begin(); - AString::iterator end = s.end(); - - while (i != end) - { - *i = (char)toupper(*i); - ++i; - } + std::transform(s.begin(), s.end(), s.begin(), ::toupper); return s; } @@ -215,14 +208,7 @@ AString & StrToUpper(AString & s) AString & StrToLower(AString & s) { - AString::iterator i = s.begin(); - AString::iterator end = s.end(); - - while (i != end) - { - *i = (char)tolower(*i); - ++i; - } + std::transform(s.begin(), s.end(), s.begin(), ::tolower); return s; } @@ -232,12 +218,8 @@ AString & StrToLower(AString & s) AString StrToLower(const AString & s) { - AString res; - res.resize(s.size()); - for (AString::iterator itr = res.begin(), end = res.end(); itr != end; ++itr) - { - *itr = (char)tolower(*itr); - } + AString res(s); + std::transform(res.begin(), res.end(), res.begin(), ::tolower); return res; } |