Added: const char* version of toLower()

--HG--
branch : develop
feature/pipeline-tools
Nimetu 6 years ago
parent 4e7d337297
commit f23fa7b0fe

@ -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

@ -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)
{

Loading…
Cancel
Save