mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 18:36:31 +01:00
Core/ChatCommands: Add support for enum type arguments (PR #25242)
This commit is contained in:
committed by
GitHub
parent
6c7837f947
commit
5e40eb20e2
@@ -469,6 +469,11 @@ void wstrToUpper(std::wstring& str)
|
||||
std::transform(str.begin(), str.end(), str.begin(), wcharToUpper);
|
||||
}
|
||||
|
||||
void strToLower(std::string& str)
|
||||
{
|
||||
std::transform(str.begin(), str.end(), str.begin(), [](char c) { return std::tolower(c); });
|
||||
}
|
||||
|
||||
void wstrToLower(std::wstring& str)
|
||||
{
|
||||
std::transform(str.begin(), str.end(), str.begin(), wcharToLower);
|
||||
@@ -665,6 +670,20 @@ bool StringToBool(std::string const& str)
|
||||
return lowerStr == "1" || lowerStr == "true" || lowerStr == "yes";
|
||||
}
|
||||
|
||||
bool StringEqualI(std::string const& str1, std::string const& str2)
|
||||
{
|
||||
return std::equal(str1.begin(), str1.end(), str2.begin(), str2.end(),
|
||||
[](char a, char b)
|
||||
{
|
||||
return std::tolower(a) == std::tolower(b);
|
||||
});
|
||||
}
|
||||
|
||||
bool StringStartsWith(std::string const& haystack, std::string const& needle)
|
||||
{
|
||||
return (haystack.rfind(needle, 0) == 0);
|
||||
}
|
||||
|
||||
bool StringContainsStringI(std::string const& haystack, std::string const& needle)
|
||||
{
|
||||
return haystack.end() !=
|
||||
|
||||
Reference in New Issue
Block a user