mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
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:
parent
6cd4d136a0
commit
1277290a4a
Notes:
sideshowbarker
2024-07-19 06:40:28 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/1277290a4af Pull-request: https://github.com/SerenityOS/serenity/pull/2214 Reviewed-by: https://github.com/awesomekling
2 changed files with 6 additions and 0 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue