mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-01 03:01:09 +02:00
util: refactor upper/lowercase functions
This includes renaming Downcase() to ToLower() and make it return a string rather than modify referenced arg. Also adds ToUpper() string version.
This commit is contained in:
@ -546,9 +546,18 @@ bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out)
|
||||
return true;
|
||||
}
|
||||
|
||||
void Downcase(std::string& str)
|
||||
std::string ToLower(const std::string& str)
|
||||
{
|
||||
std::transform(str.begin(), str.end(), str.begin(), [](char c){return ToLower(c);});
|
||||
std::string r;
|
||||
for (auto ch : str) r += ToLower((unsigned char)ch);
|
||||
return r;
|
||||
}
|
||||
|
||||
std::string ToUpper(const std::string& str)
|
||||
{
|
||||
std::string r;
|
||||
for (auto ch : str) r += ToUpper((unsigned char)ch);
|
||||
return r;
|
||||
}
|
||||
|
||||
std::string Capitalize(std::string str)
|
||||
|
Reference in New Issue
Block a user