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.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index c1f22bda3..c489c868b 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -18,19 +18,15 @@
18#endif 18#endif
19 19
20/// Make a string lowercase 20/// Make a string lowercase
21void LowerStr(char* str) { 21std::string LowerStr(std::string str) {
22 for (int i = 0; str[i]; i++) { 22 std::transform(str.begin(), str.end(), str.begin(), ::tolower);
23 str[i] = tolower(str[ i ]); 23 return str;
24 }
25} 24}
26 25
27/// Make a string uppercase 26/// Make a string uppercase
28void UpperStr(char* str) { 27std::string UpperStr(std::string str) {
29 for (int i=0; i < strlen(str); i++) { 28 std::transform(str.begin(), str.end(), str.begin(), ::toupper);
30 if(str[i] >= 'a' && str[i] <= 'z') { 29 return str;
31 str[i] &= 0xDF;
32 }
33 }
34} 30}
35 31
36// faster than sscanf 32// faster than sscanf