From cb504e236bb21816b5794a14c4dc57d93766e5a8 Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 14 Apr 2014 21:25:46 -0400 Subject: added helper functions for upper/lowercase strings --- src/common/string_util.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/common/string_util.cpp') diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index a99644f1..e5a9ba32 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -17,6 +17,22 @@ #include #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) { -- cgit v1.2.3