summaryrefslogtreecommitdiffstats
path: root/source/core/slang-string.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/core/slang-string.cpp')
-rw-r--r--source/core/slang-string.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/core/slang-string.cpp b/source/core/slang-string.cpp
index 648249b2c..28acde6ac 100644
--- a/source/core/slang-string.cpp
+++ b/source/core/slang-string.cpp
@@ -45,6 +45,23 @@ namespace Slang
// UnownedStringSlice
+ bool UnownedStringSlice::startsWith(UnownedStringSlice const& other) const
+ {
+ UInt thisSize = size();
+ UInt otherSize = other.size();
+
+ if (otherSize > thisSize)
+ return false;
+
+ return UnownedStringSlice(begin(), begin() + otherSize) == other;
+ }
+
+ bool UnownedStringSlice::startsWith(char const* str) const
+ {
+ return startsWith(UnownedTerminatedStringSlice(str));
+ }
+
+
bool UnownedStringSlice::endsWith(UnownedStringSlice const& other) const
{
UInt thisSize = size();