summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Loader/Resource.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-05-24 11:50:46 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-24 11:59:18 +0200
commitde395a3df236eb653db78b5b88a0178036f99ba0 (patch)
tree2a6bd2f6126aa62650fc92092eaa4d88ebebc19e /Userland/Libraries/LibWeb/Loader/Resource.cpp
parent875a2cbb7150b036af343364a8bf2d07a97dd03d (diff)
downloadserenity-de395a3df236eb653db78b5b88a0178036f99ba0.zip
AK+Everywhere: Consolidate String::index_of() and String::find()
We had two functions for doing mostly the same thing. Combine both of them into String::find() and use that everywhere. Also add some tests to cover basic behavior.
Diffstat (limited to 'Userland/Libraries/LibWeb/Loader/Resource.cpp')
-rw-r--r--Userland/Libraries/LibWeb/Loader/Resource.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/Loader/Resource.cpp b/Userland/Libraries/LibWeb/Loader/Resource.cpp
index 09ebeafe9c..0b75b8f886 100644
--- a/Userland/Libraries/LibWeb/Loader/Resource.cpp
+++ b/Userland/Libraries/LibWeb/Loader/Resource.cpp
@@ -43,7 +43,7 @@ void Resource::for_each_client(Function<void(ResourceClient&)> callback)
static Optional<String> encoding_from_content_type(const String& content_type)
{
- auto offset = content_type.index_of("charset=");
+ auto offset = content_type.find("charset="sv);
if (offset.has_value()) {
auto encoding = content_type.substring(offset.value() + 8, content_type.length() - offset.value() - 8).to_lowercase();
if (encoding.length() >= 2 && encoding.starts_with('"') && encoding.ends_with('"'))
@@ -58,7 +58,7 @@ static Optional<String> encoding_from_content_type(const String& content_type)
static String mime_type_from_content_type(const String& content_type)
{
- auto offset = content_type.index_of(";");
+ auto offset = content_type.find(';');
if (offset.has_value())
return content_type.substring(0, offset.value()).to_lowercase();