diff options
author | archshift <admin@archshift.com> | 2014-09-07 09:49:52 +0200 |
---|---|---|
committer | archshift <admin@archshift.com> | 2014-09-09 00:41:58 +0200 |
commit | 4ed24a06191a0dbf68bd72ad0fcc8d467b37f580 (patch) | |
tree | f3a1e6b49dc193153d039c1144b3789a9e7a7bc6 /src/common | |
parent | Merge pull request #95 from lioncash/disassembler (diff) | |
download | yuzu-4ed24a06191a0dbf68bd72ad0fcc8d467b37f580.tar yuzu-4ed24a06191a0dbf68bd72ad0fcc8d467b37f580.tar.gz yuzu-4ed24a06191a0dbf68bd72ad0fcc8d467b37f580.tar.bz2 yuzu-4ed24a06191a0dbf68bd72ad0fcc8d467b37f580.tar.lz yuzu-4ed24a06191a0dbf68bd72ad0fcc8d467b37f580.tar.xz yuzu-4ed24a06191a0dbf68bd72ad0fcc8d467b37f580.tar.zst yuzu-4ed24a06191a0dbf68bd72ad0fcc8d467b37f580.zip |
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/string_util.cpp | 16 | ||||
-rw-r--r-- | src/common/string_util.h | 5 |
2 files changed, 9 insertions, 12 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 @@ #endif /// Make a string lowercase -void LowerStr(char* str) { - for (int i = 0; str[i]; i++) { - str[i] = tolower(str[ i ]); - } +std::string LowerStr(std::string str) { + std::transform(str.begin(), str.end(), str.begin(), ::tolower); + return str; } /// Make a string uppercase -void UpperStr(char* str) { - for (int i=0; i < strlen(str); i++) { - if(str[i] >= 'a' && str[i] <= 'z') { - str[i] &= 0xDF; - } - } +std::string UpperStr(std::string str) { + std::transform(str.begin(), str.end(), str.begin(), ::toupper); + return str; } // faster than sscanf diff --git a/src/common/string_util.h b/src/common/string_util.h index ba4cd363e..b1118816e 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h @@ -13,10 +13,11 @@ #include "common/common.h" /// Make a string lowercase -void LowerStr(char* str); + +std::string LowerStr(std::string str); /// Make a string uppercase -void UpperStr(char* str); +std::string UpperStr(std::string str); std::string StringFromFormat(const char* format, ...); // Cheap! |