summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorMax Wipfli <mail@maxwipfli.ch>2021-07-01 15:01:29 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-02 21:54:21 +0200
commit3bdaed501e13a8b2dcdbbe2b5f4f68ffa22db59e (patch)
tree223fcf2b828bcf3bc93f636c1e5a1611c5961bd9 /Userland/Applications
parent56253bf3895e258729130a7ec22acff74e5b4212 (diff)
downloadserenity-3bdaed501e13a8b2dcdbbe2b5f4f68ffa22db59e.zip
AK+Everywhere: Remove StringView::find_{first,last}_of(char) methods
This removes StringView::find_first_of(char) and find_last_of(char) and replaces all its usages with find and find_last respectively. This is because those two methods are functionally equivalent. find_{first,last}_of should only be used if searching for multiple different characters, which is never the case with the char argument. This also adds the [[nodiscard]] to the remaining find_{first,last}_of methods.
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/Browser/CookieJar.cpp2
-rw-r--r--Userland/Applications/SoundPlayer/M3UParser.cpp2
-rw-r--r--Userland/Applications/Spreadsheet/Spreadsheet.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Applications/Browser/CookieJar.cpp b/Userland/Applications/Browser/CookieJar.cpp
index 2cdab6aea6..4a27cc53c9 100644
--- a/Userland/Applications/Browser/CookieJar.cpp
+++ b/Userland/Applications/Browser/CookieJar.cpp
@@ -142,7 +142,7 @@ String CookieJar::default_path(const URL& url)
return "/";
StringView uri_path_view = uri_path;
- std::size_t last_separator = uri_path_view.find_last_of('/').value();
+ size_t last_separator = uri_path_view.find_last('/').value();
// 3. If the uri-path contains no more than one %x2F ("/") character, output %x2F ("/") and skip the remaining step.
if (last_separator == 0)
diff --git a/Userland/Applications/SoundPlayer/M3UParser.cpp b/Userland/Applications/SoundPlayer/M3UParser.cpp
index e7c3e2ffda..b8267ec624 100644
--- a/Userland/Applications/SoundPlayer/M3UParser.cpp
+++ b/Userland/Applications/SoundPlayer/M3UParser.cpp
@@ -64,7 +64,7 @@ NonnullOwnPtr<Vector<M3UEntry>> M3UParser::parse(bool include_extended_info)
if (line.starts_with('#') && has_exteded_info_tag) {
if (line.starts_with("#EXTINF")) {
auto data = line.substring_view(8);
- auto separator = data.find_first_of(',');
+ auto separator = data.find(',');
VERIFY(separator.has_value());
auto seconds = data.substring_view(0, separator.value());
VERIFY(!seconds.is_whitespace() && !seconds.is_null() && !seconds.is_empty());
diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp
index e845914d5e..95ddffcbca 100644
--- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp
+++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp
@@ -91,7 +91,7 @@ static size_t convert_from_string(StringView str, unsigned base = 26, StringView
size_t value = 0;
for (size_t i = str.length(); i > 0; --i) {
- auto digit_value = map.find_first_of(str[i - 1]).value_or(0);
+ auto digit_value = map.find(str[i - 1]).value_or(0);
// NOTE: Refer to the note in `String::bijective_base_from()'.
if (i == str.length() && str.length() > 1)
++digit_value;