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
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
@ -289,6 +289,13 @@ namespace utils {
|
||||
|
||||
std::string lowercase(const std::string &line);
|
||||
|
||||
/*! Convert string to uppercase
|
||||
*
|
||||
* \param line string that should be converted
|
||||
* \return new string with all uppercase characters */
|
||||
|
||||
std::string uppercase(const std::string &line);
|
||||
|
||||
/*! Trim leading and trailing whitespace. Like TRIM() in Fortran.
|
||||
*
|
||||
* \param line string that should be trimmed
|
||||
|
||||
Reference in New Issue
Block a user