summaryrefslogtreecommitdiffstats
path: root/src/StringUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/StringUtils.cpp')
-rw-r--r--src/StringUtils.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp
index 0e30e8ebb..5f88cbf64 100644
--- a/src/StringUtils.cpp
+++ b/src/StringUtils.cpp
@@ -196,9 +196,9 @@ AString TrimString(const AString & str)
-AString & StrToUpper(AString & s)
+AString & InPlaceLowercase(AString & s)
{
- std::transform(s.begin(), s.end(), s.begin(), ::toupper);
+ std::transform(s.begin(), s.end(), s.begin(), ::tolower);
return s;
}
@@ -206,9 +206,9 @@ AString & StrToUpper(AString & s)
-AString & StrToLower(AString & s)
+AString & InPlaceUppercase(AString & s)
{
- std::transform(s.begin(), s.end(), s.begin(), ::tolower);
+ std::transform(s.begin(), s.end(), s.begin(), ::toupper);
return s;
}
@@ -227,16 +227,25 @@ AString StrToLower(const AString & s)
+AString StrToUpper(const AString & s)
+{
+ AString res(s);
+ std::transform(res.begin(), res.end(), res.begin(), ::toupper);
+ return res;
+}
+
+
+
+
+
int NoCaseCompare(const AString & s1, const AString & s2)
{
#ifdef _MSC_VER
// MSVC has stricmp that compares case-insensitive:
return _stricmp(s1.c_str(), s2.c_str());
#else
- // Do it the hard way:
- AString s1Copy(s1);
- AString s2Copy(s2);
- return StrToUpper(s1Copy).compare(StrToUpper(s2Copy));
+ // Do it the hard way - convert both strings to lowercase:
+ return StrToLower(s1).compare(StrToLower(s2));
#endif // else _MSC_VER
}