diff options
Diffstat (limited to 'source/core/slang-string.cpp')
| -rw-r--r-- | source/core/slang-string.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/source/core/slang-string.cpp b/source/core/slang-string.cpp index 5f2ba13ba..9b3575ad8 100644 --- a/source/core/slang-string.cpp +++ b/source/core/slang-string.cpp @@ -155,12 +155,27 @@ namespace Slang end() - otherSize, end()) == other; } + bool UnownedStringSlice::endsWithCaseInsensitive(UnownedStringSlice const& other) const + { + UInt thisSize = getLength(); + UInt otherSize = other.getLength(); + + if (otherSize > thisSize) + return false; + + return UnownedStringSlice(end() - otherSize, end()).caseInsensitiveEquals(other); + } + bool UnownedStringSlice::endsWith(char const* str) const { return endsWith(UnownedTerminatedStringSlice(str)); } - + bool UnownedStringSlice::endsWithCaseInsensitive(char const* str) const + { + return endsWithCaseInsensitive(UnownedTerminatedStringSlice(str)); + } + UnownedStringSlice UnownedStringSlice::trim() const { const char* start = m_begin; |
