summaryrefslogtreecommitdiff
path: root/src/common/string_util.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2014-09-11 00:04:36 -0400
committerGravatar bunnei2014-09-11 00:04:36 -0400
commit532a9e80a0bd242d2937335063b719130405d6bc (patch)
tree84fe1f054b62edc488a7a9e80eb8f79b2dd05cd0 /src/common/string_util.cpp
parentMerge pull request #103 from archshift/prune (diff)
parentMoved common_types::Rect from common to Common namespace (diff)
downloadyuzu-532a9e80a0bd242d2937335063b719130405d6bc.tar.gz
yuzu-532a9e80a0bd242d2937335063b719130405d6bc.tar.xz
yuzu-532a9e80a0bd242d2937335063b719130405d6bc.zip
Merge pull request #99 from archshift/ext-check
loader.cpp: improved file extension checking, made Upper/LowerStr useful, moved string_util into Common namespace
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}