mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:27:35 +00:00
AK: Move String::ends_with implementation to StringUtils
Centralizing so it can be used by other string implementations
This commit is contained in:
parent
d98e743568
commit
8e4b858b3f
3 changed files with 15 additions and 7 deletions
|
@ -280,13 +280,7 @@ bool String::starts_with(char ch) const
|
|||
|
||||
bool String::ends_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() + (length() - str.length()), str.characters_without_null_termination(), str.length());
|
||||
return StringUtils::ends_with(*this, str);
|
||||
}
|
||||
|
||||
bool String::ends_with(char ch) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue