mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
AK: Implement StringView::find_all()
This implements the StringView::find_all() method by re-implemeting the current method existing for String in StringUtils, and using that implementation for both String and StringView. The rewrite uses memmem() instead of strstr(), so the String::find_all() argument type has been changed from String to StringView, as the null byte is no longer required.
This commit is contained in:
parent
3bdaed501e
commit
d7a104c27c
Notes:
sideshowbarker
2024-07-18 11:06:14 +09:00
Author: https://github.com/MaxWipfli
Commit: d7a104c27c
Pull-request: https://github.com/SerenityOS/serenity/pull/8368
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/trflynn89
4 changed files with 19 additions and 18 deletions
|
@ -91,6 +91,8 @@ public:
|
|||
[[nodiscard]] Optional<size_t> find_last(char needle) const { return StringUtils::find_last(*this, needle); }
|
||||
// FIXME: Implement find_last(StringView const&) for API symmetry.
|
||||
|
||||
[[nodiscard]] Vector<size_t> find_all(StringView const& needle) const { return StringUtils::find_all(*this, needle); }
|
||||
|
||||
[[nodiscard]] Optional<size_t> find_first_of(StringView const&) const;
|
||||
[[nodiscard]] Optional<size_t> find_last_of(StringView const&) const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue