diff --git a/code/nel/include/nel/misc/common.h b/code/nel/include/nel/misc/common.h index eb70fce9e..d5d59b130 100644 --- a/code/nel/include/nel/misc/common.h +++ b/code/nel/include/nel/misc/common.h @@ -222,6 +222,7 @@ inline double isValidDouble (double v) * \param str a string to transform to lower case */ +std::string toLower ( const char *str ); std::string toLower ( const std::string &str ); void toLower ( char *str ); char toLower ( const char ch ); // convert only one character diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index 48e6e9845..72f29eb82 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -591,6 +591,22 @@ NLMISC_CATEGORISED_COMMAND(nel,stohr, "Convert a second number into an human rea return true; } +std::string toLower(const char *str) +{ + if (!str) return ""; + + uint len = strlen(str); + string res; + res.reserve(len); + for(uint i = 0; i < len; i++) + { + if( (str[i] >= 'A') && (str[i] <= 'Z') ) + res += str[i] - 'A' + 'a'; + else + res += str[i]; + } + return res; +} std::string toLower(const std::string &str) {