60 std::string
toLower(std::string_view str) {
61 std::string result{str};
62 std::ranges::transform(result, result.begin(), [](
unsigned char c) { return std::tolower(c); });
67 bool contains(std::string_view s, std::string_view needle) {
68 return s.find(needle) != std::string_view::npos;
74 std::ranges::find_if_not(s, [](
unsigned char ch) { return std::isspace(ch); }));
79 auto it = std::ranges::find_if_not(s | std::views::reverse,
80 [](
unsigned char ch) {
return std::isspace(ch); });
81 s.erase(it.base(), s.end());
85 void trim(std::string& s) {
93 std::erase(res,
'\n');
94 std::erase(res,
'\r');
bool contains(std::string_view s, std::string_view needle)
true if needle in s
std::string remove_newline(std::string_view s)
remove all newlines in a string
std::string toLower(std::string_view str)
Returns the lowercase version of str.
bool isIntegerWithResult(std::string_view val, int *res)
return true is a string contains an integer value
void ltrim(std::string &s)
trim from start (in place)
std::string trim_copy(std::string_view s)
trim from both ends (copying)
bool isInteger(std::string_view val)
return true is a string contains an integer value
void trim(std::string &s)
trim from both ends (in place)
bool isNumerical(std::string_view val)
return true is a string contains a numerical (double) value
void rtrim(std::string &s)
trim from end (in place)
bool isNumericalWithResult(std::string_view val, double *res)
return true is a string contains a numerical (double) value
gum is the global namespace for all aGrUM entities
Utilities for manipulating strings.