mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
added toUpper
This commit is contained in:
@@ -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)) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user