AK: Use memchr for StringView::contains()

This commit is contained in:
Tim Ledbetter 2026-05-11 09:35:14 +01:00 committed by Jelle Raaijmakers
parent 381910a51d
commit 4115803fd9

View file

@ -165,11 +165,7 @@ bool StringView::matches(StringView mask, CaseSensitivity case_sensitivity) cons
bool StringView::contains(char needle) const
{
for (char current : *this) {
if (current == needle)
return true;
}
return false;
return memchr(m_characters, static_cast<unsigned char>(needle), m_length) != nullptr;
}
bool StringView::contains(u32 needle) const