AK: Add StringView::equals_ignoring_case()

StringUtils::equals_ignoring_case() already operates on a StringView&,
so StringView should have the method directly without having to go
through a temporary String (which also has the method).
This commit is contained in:
Linus Groh 2020-05-13 17:59:31 +01:00 committed by Andreas Kling
parent 6cd4d136a0
commit 1277290a4a
Notes: sideshowbarker 2024-07-19 06:40:28 +09:00
2 changed files with 6 additions and 0 deletions

View file

@ -166,6 +166,11 @@ bool StringView::contains(char needle) const
return false;
}
bool StringView::equals_ignoring_case(const StringView& other) const
{
return StringUtils::equals_ignoring_case(*this, other);
}
StringView StringView::substring_view(size_t start, size_t length) const
{
ASSERT(start + length <= m_length);

View file

@ -78,6 +78,7 @@ public:
bool ends_with(char) const;
bool matches(const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;
bool contains(char) const;
bool equals_ignoring_case(const StringView& other) const;
Optional<size_t> find_first_of(char) const;
Optional<size_t> find_first_of(const StringView&) const;