add uppercase string utility function (for symmetry)
This commit is contained in:
@ -312,7 +312,7 @@ int utils::logical(const char *file, int line, const char *str, bool do_abort, L
|
||||
lmp->error->all(file, line, msg);
|
||||
}
|
||||
|
||||
// convert to ascii and lowercase
|
||||
// convert to ascii
|
||||
std::string buf(str);
|
||||
if (has_utf8(buf)) buf = utf8_subst(buf);
|
||||
|
||||
@ -705,6 +705,17 @@ std::string utils::lowercase(const std::string &text)
|
||||
return converted;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Return string converted to uppercase
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
std::string utils::uppercase(const std::string &text)
|
||||
{
|
||||
std::string converted;
|
||||
for (auto c : text) converted += ::toupper(c);
|
||||
return converted;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Return string without leading or trailing whitespace
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user