mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +00:00
AK: Enhance String::contains to allow case-insensitive searches
This commit is contained in:
parent
6413acd78c
commit
25e7225782
7 changed files with 54 additions and 8 deletions
|
@ -275,11 +275,9 @@ bool String::matches(const StringView& mask, CaseSensitivity case_sensitivity) c
|
|||
return StringUtils::matches(*this, mask, case_sensitivity);
|
||||
}
|
||||
|
||||
bool String::contains(const String& needle) const
|
||||
bool String::contains(const StringView& needle, CaseSensitivity case_sensitivity) const
|
||||
{
|
||||
if (is_null() || needle.is_null())
|
||||
return false;
|
||||
return strstr(characters(), needle.characters());
|
||||
return StringUtils::contains(*this, needle, case_sensitivity);
|
||||
}
|
||||
|
||||
Optional<size_t> String::index_of(const String& needle, size_t start) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue