Added performers. fixes #278

This commit is contained in:
emeric
2022-12-14 20:07:54 +01:00
parent 495005357c
commit 998def846d
27 changed files with 451 additions and 96 deletions
+25 -6
View File
@@ -115,17 +115,21 @@ joinStrings(const std::vector<std::string>& strings, const std::string& delimite
return boost::algorithm::join(strings, delimiter);
}
std::string
std::string_view
stringTrim(std::string_view str, std::string_view whitespaces)
{
std::string_view res;
const auto strBegin = str.find_first_not_of(whitespaces);
if (strBegin == std::string_view::npos)
return ""; // no content
if (strBegin != std::string_view::npos)
{
const auto strEnd {str.find_last_not_of(whitespaces)};
const auto strRange {strEnd - strBegin + 1};
const auto strEnd = str.find_last_not_of(whitespaces);
const auto strRange = strEnd - strBegin + 1;
res = str.substr(strBegin, strRange);
}
return std::string {str.substr(strBegin, strRange)};
return res;
}
std::string
@@ -175,6 +179,21 @@ bufferToString(const std::vector<unsigned char>& data)
return oss.str();
}
void
capitalize(std::string& str)
{
for (auto it {std::begin(str)}; it != std::end(str); ++it)
{
if (std::isspace(*it))
continue;
if (std::isalpha(*it))
*it = std::toupper(*it);
break;
}
}
std::string
replaceInString(std::string_view str, const std::string& from, const std::string& to)
{