diff options
author | bunnei <ericbunnie@gmail.com> | 2014-04-14 21:25:46 -0400 |
---|---|---|
committer | bunnei <ericbunnie@gmail.com> | 2014-04-14 21:25:46 -0400 |
commit | cb504e236bb21816b5794a14c4dc57d93766e5a8 (patch) | |
tree | 1e97e5923671d473c78131898ccdeb0b9fd539ee /src/common/string_util.cpp | |
parent | 18766b9e69bf822764eba98237325d07b3c4ef0f (diff) |
added helper functions for upper/lowercase strings
Diffstat (limited to 'src/common/string_util.cpp')
-rw-r--r-- | src/common/string_util.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index a99644f118..e5a9ba3223 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -17,6 +17,22 @@ #include <errno.h> #endif +/// Make a string lowercase +void LowerStr(char* str) { + for (int i = 0; str[i]; i++) { + str[i] = tolower(str[ i ]); + } +} + +/// 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; + } + } +} + // faster than sscanf bool AsciiToHex(const char* _szValue, u32& result) { |