mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:08:12 +00:00
AK: Add case insensitive version of starts_with
This commit is contained in:
parent
ccc929dcf9
commit
a5ecb9bd6b
11 changed files with 53 additions and 20 deletions
|
@ -260,15 +260,9 @@ String String::format(const char* fmt, ...)
|
|||
return builder.to_string();
|
||||
}
|
||||
|
||||
bool String::starts_with(const StringView& str) const
|
||||
bool String::starts_with(const StringView& str, CaseSensitivity case_sensitivity) const
|
||||
{
|
||||
if (str.is_empty())
|
||||
return true;
|
||||
if (is_empty())
|
||||
return false;
|
||||
if (str.length() > length())
|
||||
return false;
|
||||
return !memcmp(characters(), str.characters_without_null_termination(), str.length());
|
||||
return StringUtils::starts_with(*this, str, case_sensitivity);
|
||||
}
|
||||
|
||||
bool String::starts_with(char ch) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue