mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-19 13:03:11 +01:00
Refactor various methods to use std::string
This commit is contained in:
@@ -50,6 +50,26 @@ namespace String
|
||||
return str == nullptr || str[0] == '\0';
|
||||
}
|
||||
|
||||
sint32 Compare(const std::string &a, const std::string &b, bool ignoreCase = false)
|
||||
{
|
||||
return Compare(a.c_str(), b.c_str(), ignoreCase);
|
||||
}
|
||||
|
||||
sint32 Compare(const utf8 * a, const utf8 * b, bool ignoreCase = false)
|
||||
{
|
||||
if (a == b) return true;
|
||||
if (a == nullptr || b == nullptr) return false;
|
||||
|
||||
if (ignoreCase)
|
||||
{
|
||||
return _stricmp(a, b);
|
||||
}
|
||||
else
|
||||
{
|
||||
return strcmp(a, b);
|
||||
}
|
||||
}
|
||||
|
||||
bool Equals(const utf8 * a, const utf8 * b, bool ignoreCase)
|
||||
{
|
||||
if (a == b) return true;
|
||||
@@ -247,6 +267,11 @@ namespace String
|
||||
return buffer;
|
||||
}
|
||||
|
||||
utf8 * Duplicate(const std::string &src)
|
||||
{
|
||||
return String::Duplicate(src.c_str());
|
||||
}
|
||||
|
||||
utf8 * Duplicate(const utf8 * src)
|
||||
{
|
||||
utf8 * result = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user