1
0
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:
Ted John
2017-01-05 13:13:22 +00:00
parent f201a8b43a
commit be035dcdb2
7 changed files with 71 additions and 20 deletions

View File

@@ -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;