added toUpper

This commit is contained in:
proddy
2021-03-26 17:29:13 +01:00
parent da7b0e9597
commit c75a1c9e1e
2 changed files with 7 additions and 0 deletions

View File

@@ -432,6 +432,12 @@ std::string Helpers::toLower(std::string const & s) {
return lc;
}
std::string Helpers::toUpper(std::string const & s) {
std::string lc = s;
std::transform(lc.begin(), lc.end(), lc.begin(), [](unsigned char c) { return std::toupper(c); });
return lc;
}
// checks if we can convert a char string to a lowercase string
bool Helpers::value2string(const char * v, std::string & value) {
if ((v == nullptr) || (strlen(v) == 0)) {

View File

@@ -52,6 +52,7 @@ class Helpers {
static uint32_t abs(const int32_t i);
static double round2(double value, const uint8_t divider);
static std::string toLower(std::string const & s);
static std::string toUpper(std::string const & s);
static bool hasValue(const uint8_t & v, const uint8_t isBool = 0);
static bool hasValue(const int8_t & v);