add utility to convert a string to lowercase
This commit is contained in:
@ -694,6 +694,17 @@ char *utils::strdup(const std::string &text)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Return string converted to lowercase
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
std::string utils::lowercase(const std::string &text)
|
||||
{
|
||||
std::string converted;
|
||||
for (auto c : text) converted += ::tolower(c);
|
||||
return converted;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Return string without leading or trailing whitespace
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user