AK: Implement String::find_any_of() and StringView::find_any_of()

This implements StringUtils::find_any_of() and uses it in
String::find_any_of() and StringView::find_any_of(). All uses of
find_{first,last}_of have been replaced with find_any_of(), find() or
find_last(). find_{first,last}_of have subsequently been removed.
This commit is contained in:
Max Wipfli 2021-07-01 18:12:21 +02:00 committed by Andreas Kling
commit 9cc35d1ba3
Notes: sideshowbarker 2024-07-18 11:06:02 +09:00
12 changed files with 44 additions and 52 deletions

View file

@ -62,6 +62,11 @@ Optional<size_t> find(StringView const& haystack, char needle, size_t start = 0)
Optional<size_t> find(StringView const& haystack, StringView const& needle, size_t start = 0);
Optional<size_t> find_last(StringView const& haystack, char needle);
Vector<size_t> find_all(StringView const& haystack, StringView const& needle);
enum class SearchDirection {
Forward,
Backward
};
Optional<size_t> find_any_of(StringView const& haystack, StringView const& needles, SearchDirection);
String to_snakecase(const StringView&);