Skip to content

Commit c75a1c9

Browse files
committed
added toUpper
1 parent da7b0e9 commit c75a1c9

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/helpers.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,12 @@ std::string Helpers::toLower(std::string const & s) {
432432
return lc;
433433
}
434434

435+
std::string Helpers::toUpper(std::string const & s) {
436+
std::string lc = s;
437+
std::transform(lc.begin(), lc.end(), lc.begin(), [](unsigned char c) { return std::toupper(c); });
438+
return lc;
439+
}
440+
435441
// checks if we can convert a char string to a lowercase string
436442
bool Helpers::value2string(const char * v, std::string & value) {
437443
if ((v == nullptr) || (strlen(v) == 0)) {

src/helpers.h

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class Helpers {
5252
static uint32_t abs(const int32_t i);
5353
static double round2(double value, const uint8_t divider);
5454
static std::string toLower(std::string const & s);
55+
static std::string toUpper(std::string const & s);
5556

5657
static bool hasValue(const uint8_t & v, const uint8_t isBool = 0);
5758
static bool hasValue(const int8_t & v);

0 commit comments

Comments
 (0)