mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
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:
parent
17eddf3ac4
commit
9cc35d1ba3
Notes:
sideshowbarker
2024-07-18 11:06:02 +09:00
Author: https://github.com/MaxWipfli
Commit: 9cc35d1ba3
Pull-request: https://github.com/SerenityOS/serenity/pull/8368
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/trflynn89
12 changed files with 44 additions and 52 deletions
|
@ -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 });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue