|
@@ -180,6 +180,17 @@ String String::format(const char* fmt, ...)
|
|
|
return builder.to_string();
|
|
|
}
|
|
|
|
|
|
+bool String::starts_with(const StringView& str) const
|
|
|
+{
|
|
|
+ if (str.is_empty())
|
|
|
+ return true;
|
|
|
+ if (is_empty())
|
|
|
+ return false;
|
|
|
+ if (str.length() > length())
|
|
|
+ return false;
|
|
|
+ return !memcmp(characters(), str.characters(), str.length());
|
|
|
+}
|
|
|
+
|
|
|
bool String::ends_with(const StringView& str) const
|
|
|
{
|
|
|
if (str.is_empty())
|