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

@ -252,7 +252,7 @@ bool Editor::load_history(const String& path)
auto data = history_file->read_all();
auto hist = StringView { data.data(), data.size() };
for (auto& str : hist.split_view("\n\n")) {
auto it = str.find_first_of("::").value_or(0);
auto it = str.find("::").value_or(0);
auto time = str.substring_view(0, it).to_uint<time_t>().value_or(0);
auto string = str.substring_view(it == 0 ? it : it + 2);
m_history.append({ string, time });