Merge pull request #217 from diamante0018/string-funcs
[String] Port changes from S1x
This commit is contained in:
commit
689ea11a20
@ -23,16 +23,24 @@ namespace Utils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ToLower(std::string input)
|
std::string ToLower(std::string text)
|
||||||
{
|
{
|
||||||
std::transform(input.begin(), input.end(), input.begin(), ::tolower);
|
std::transform(text.begin(), text.end(), text.begin(), [](const unsigned char input)
|
||||||
return input;
|
{
|
||||||
|
return static_cast<char>(std::tolower(input));
|
||||||
|
});
|
||||||
|
|
||||||
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ToUpper(std::string input)
|
std::string ToUpper(std::string text)
|
||||||
{
|
{
|
||||||
std::transform(input.begin(), input.end(), input.begin(), ::toupper);
|
std::transform(text.begin(), text.end(), text.begin(), [](const unsigned char input)
|
||||||
return input;
|
{
|
||||||
|
return static_cast<char>(std::toupper(input));
|
||||||
|
});
|
||||||
|
|
||||||
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DumpHex(const std::string& data, const std::string& separator)
|
std::string DumpHex(const std::string& data, const std::string& separator)
|
||||||
|
@ -75,8 +75,8 @@ namespace Utils
|
|||||||
const char *VA(const char *fmt, ...);
|
const char *VA(const char *fmt, ...);
|
||||||
|
|
||||||
int IsSpace(int c);
|
int IsSpace(int c);
|
||||||
std::string ToLower(std::string input);
|
std::string ToLower(std::string text);
|
||||||
std::string ToUpper(std::string input);
|
std::string ToUpper(std::string text);
|
||||||
bool EndsWith(const std::string& haystack, const std::string& needle);
|
bool EndsWith(const std::string& haystack, const std::string& needle);
|
||||||
std::vector<std::string> Split(const std::string& str, const char delim);
|
std::vector<std::string> Split(const std::string& str, const char delim);
|
||||||
void Replace(std::string& string, const std::string& find, const std::string& replace);
|
void Replace(std::string& string, const std::string& find, const std::string& replace);
|
||||||
|
Loading…
Reference in New Issue
Block a user