1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 12:03:07 +01:00

Remove unused String::Substring

This commit is contained in:
Ted John
2018-02-06 18:02:58 +00:00
parent b6823242b6
commit 0fc0d16e85
2 changed files with 0 additions and 50 deletions

View File

@@ -342,46 +342,6 @@ namespace String
return DiscardUse(ptr, String::Duplicate(replacement));
}
utf8 * Substring(const utf8 * buffer, size_t index)
{
size_t bufferSize = String::SizeOf(buffer);
bool goodSubstring = index <= bufferSize;
Guard::Assert(goodSubstring, "Substring past end of input string.");
// If assertion continues, return empty string to avoid crash
if (!goodSubstring)
{
return String::Duplicate("");
}
return String::Duplicate(buffer + index);
}
utf8 * Substring(const utf8 * buffer, size_t index, size_t size)
{
size_t bufferSize = String::SizeOf(buffer);
bool goodSubstring = index + size <= bufferSize;
Guard::Assert(goodSubstring, "Substring past end of input string.");
// If assertion continues, cap the substring to avoid crash
if (!goodSubstring)
{
if (index >= bufferSize)
{
size = 0;
}
else
{
size = bufferSize - index;
}
}
utf8 * result = Memory::Allocate<utf8>(size + 1);
std::copy_n(buffer + index, size, result);
result[size] = '\0';
return result;
}
std::vector<std::string> Split(const std::string &s, const std::string &delimiter)
{
if (delimiter.empty())