mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-28 20:29:03 +00:00
AK: Add StringView::contains(StringView)
This commit is contained in:
parent
1ad51325ad
commit
fd64be02e0
Notes:
sideshowbarker
2024-07-19 04:25:36 +09:00
Author: https://github.com/alimpfard
Commit: fd64be02e0
Pull-request: https://github.com/SerenityOS/serenity/pull/2694
Issue: https://github.com/SerenityOS/serenity/issues/2685
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/bugaevc
2 changed files with 6 additions and 0 deletions
|
@ -178,6 +178,11 @@ bool StringView::contains(char needle) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool StringView::contains(const StringView& needle) const
|
||||||
|
{
|
||||||
|
return memmem(m_characters, m_length, needle.m_characters, needle.m_length) != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool StringView::equals_ignoring_case(const StringView& other) const
|
bool StringView::equals_ignoring_case(const StringView& other) const
|
||||||
{
|
{
|
||||||
return StringUtils::equals_ignoring_case(*this, other);
|
return StringUtils::equals_ignoring_case(*this, other);
|
||||||
|
|
|
@ -83,6 +83,7 @@ public:
|
||||||
bool ends_with(char) const;
|
bool ends_with(char) const;
|
||||||
bool matches(const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;
|
bool matches(const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;
|
||||||
bool contains(char) const;
|
bool contains(char) const;
|
||||||
|
bool contains(const StringView&) const;
|
||||||
bool equals_ignoring_case(const StringView& other) const;
|
bool equals_ignoring_case(const StringView& other) const;
|
||||||
|
|
||||||
Optional<size_t> find_first_of(char) const;
|
Optional<size_t> find_first_of(char) const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue