summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-09-30 19:59:40 +0200
committermadmaxoft <github@xoft.cz>2013-10-04 13:10:29 +0200
commite31343297ee648c799a4d30b578259719f21ede5 (patch)
treecc04b88db435865c69cc360d0460e26031f704ad
parentImproved the HTTPFormParser code. (diff)
downloadcuberite-e31343297ee648c799a4d30b578259719f21ede5.tar
cuberite-e31343297ee648c799a4d30b578259719f21ede5.tar.gz
cuberite-e31343297ee648c799a4d30b578259719f21ede5.tar.bz2
cuberite-e31343297ee648c799a4d30b578259719f21ede5.tar.lz
cuberite-e31343297ee648c799a4d30b578259719f21ede5.tar.xz
cuberite-e31343297ee648c799a4d30b578259719f21ede5.tar.zst
cuberite-e31343297ee648c799a4d30b578259719f21ede5.zip
-rw-r--r--source/StringUtils.cpp17
-rw-r--r--source/StringUtils.h3
2 files changed, 20 insertions, 0 deletions
diff --git a/source/StringUtils.cpp b/source/StringUtils.cpp
index d53d25866..c62bb3acb 100644
--- a/source/StringUtils.cpp
+++ b/source/StringUtils.cpp
@@ -196,6 +196,23 @@ 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;
+ }
+ return s;
+}
+
+
+
+
+
int NoCaseCompare(const AString & s1, const AString & s2)
{
#ifdef _MSC_VER
diff --git a/source/StringUtils.h b/source/StringUtils.h
index 929e6fd5b..e35e58c9f 100644
--- a/source/StringUtils.h
+++ b/source/StringUtils.h
@@ -45,6 +45,9 @@ extern AString TrimString(const AString & str); // tolua_export
/// In-place string conversion to uppercase; returns the same string
extern AString & StrToUpper(AString & s);
+/// In-place string conversion to lowercase; returns the same string
+extern AString & StrToLower(AString & s);
+
/// Case-insensitive string comparison; returns 0 if the strings are the same
extern int NoCaseCompare(const AString & s1, const AString & s2); // tolua_export