summaryrefslogtreecommitdiffstats
path: root/src/StringUtils.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-08-04 08:00:49 +0200
committermadmaxoft <github@xoft.cz>2014-08-04 08:00:49 +0200
commit122344bb7a71b7b4797869083c4c61f08882927a (patch)
treed8adc2ac3378e7dd05fa061037818c824945ea7d /src/StringUtils.cpp
parentAttempting a compilation fix for gcc / clang. (diff)
downloadcuberite-122344bb7a71b7b4797869083c4c61f08882927a.tar
cuberite-122344bb7a71b7b4797869083c4c61f08882927a.tar.gz
cuberite-122344bb7a71b7b4797869083c4c61f08882927a.tar.bz2
cuberite-122344bb7a71b7b4797869083c4c61f08882927a.tar.lz
cuberite-122344bb7a71b7b4797869083c4c61f08882927a.tar.xz
cuberite-122344bb7a71b7b4797869083c4c61f08882927a.tar.zst
cuberite-122344bb7a71b7b4797869083c4c61f08882927a.zip
Diffstat (limited to 'src/StringUtils.cpp')
-rw-r--r--src/StringUtils.cpp26
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;
}