diff options
| author | 2014-09-11 00:04:36 -0400 | |
|---|---|---|
| committer | 2014-09-11 00:04:36 -0400 | |
| commit | 532a9e80a0bd242d2937335063b719130405d6bc (patch) | |
| tree | 84fe1f054b62edc488a7a9e80eb8f79b2dd05cd0 /src/common/string_util.cpp | |
| parent | Merge pull request #103 from archshift/prune (diff) | |
| parent | Moved common_types::Rect from common to Common namespace (diff) | |
| download | yuzu-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.cpp | 20 |
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 | ||
| 16 | namespace Common { | ||
| 17 | |||
| 16 | /// Make a string lowercase | 18 | /// Make a string lowercase |
| 17 | void LowerStr(char* str) { | 19 | std::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 |
| 24 | void UpperStr(char* str) { | 25 | std::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 | } | ||