mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +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
4 changed files with 19 additions and 18 deletions
|
@ -143,6 +143,7 @@ public:
|
|||
|
||||
[[nodiscard]] Optional<size_t> find(char, size_t start = 0) const;
|
||||
[[nodiscard]] Optional<size_t> find(StringView const&, size_t start = 0) const;
|
||||
[[nodiscard]] Vector<size_t> find_all(StringView const& needle) const { return StringUtils::find_all(*this, needle); }
|
||||
|
||||
[[nodiscard]] String substring(size_t start) const;
|
||||
[[nodiscard]] String substring(size_t start, size_t length) const;
|
||||
|
@ -279,7 +280,6 @@ public:
|
|||
|
||||
int replace(const String& needle, const String& replacement, bool all_occurrences = false);
|
||||
size_t count(const String& needle) const;
|
||||
Vector<size_t> find_all(const String& needle) const;
|
||||
[[nodiscard]] String reverse() const;
|
||||
|
||||
template<typename... Ts>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue