summaryrefslogtreecommitdiff
path: root/src/common/string_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/string_util.cpp')
-rw-r--r--src/common/string_util.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index b0c65d47d..9199e30bc 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -13,20 +13,18 @@
13 #include <iconv.h> 13 #include <iconv.h>
14#endif 14#endif
15 15
16namespace Common {
17
16/// Make a string lowercase 18/// Make a string lowercase
17void LowerStr(char* str) { 19std::string ToLower(std::string str) {
18 for (int i = 0; str[i]; i++) { 20 std::transform(str.begin(), str.end(), str.begin(), ::tolower);
19 str[i] = tolower(str[ i ]); 21 return str;
20 }
21} 22}
22 23
23/// Make a string uppercase 24/// Make a string uppercase
24void UpperStr(char* str) { 25std::string ToUpper(std::string str) {
25 for (int i=0; i < strlen(str); i++) { 26 std::transform(str.begin(), str.end(), str.begin(), ::toupper);
26 if(str[i] >= 'a' && str[i] <= 'z') { 27 return str;
27 str[i] &= 0xDF;
28 }
29 }
30} 28}
31 29
32// faster than sscanf 30// faster than sscanf
@@ -546,3 +544,5 @@ std::string UTF16ToUTF8(const std::wstring& input)
546} 544}
547 545
548#endif 546#endif
547
548}