mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-04 10:59:08 +02:00
Implements custom tolower and toupper functions.
This commit implements custom equivalents for the C and C++ `tolower` and `toupper` Standard Library functions. In addition it implements a utility function to capitalize the first letter of a string.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <tinyformat.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <errno.h>
|
||||
@@ -584,3 +585,15 @@ bool ParseHDKeypath(const std::string& keypath_str, std::vector<uint32_t>& keypa
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Downcase(std::string& str)
|
||||
{
|
||||
std::transform(str.begin(), str.end(), str.begin(), [](unsigned char c){return ToLower(c);});
|
||||
}
|
||||
|
||||
std::string Capitalize(std::string str)
|
||||
{
|
||||
if (str.empty()) return str;
|
||||
str[0] = ToUpper(str.front());
|
||||
return str;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user