summaryrefslogtreecommitdiff
path: root/AK/String.h
diff options
context:
space:
mode:
authorHendiadyoin1 <leon.a@serenityos.org>2022-03-20 23:52:36 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-21 10:48:17 +0100
commit820e03e8d4e197063be409c39d582800e98d0259 (patch)
treebf6a2a18247fc05ce597819d5f6584317307edee /AK/String.h
parente154c2c2cac482df9e390ab606fdd2049968fb69 (diff)
downloadserenity-820e03e8d4e197063be409c39d582800e98d0259.zip
AK: Add a case insensitive of is_one_of to String[View]
Diffstat (limited to 'AK/String.h')
-rw-r--r--AK/String.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/AK/String.h b/AK/String.h
index f7626d07e9..e4221f037f 100644
--- a/AK/String.h
+++ b/AK/String.h
@@ -302,6 +302,18 @@ public:
return (... || this->operator==(forward<Ts>(strings)));
}
+ template<typename... Ts>
+ [[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of_ignoring_case(Ts&&... strings) const
+ {
+ return (... ||
+ [this, &strings]() -> bool {
+ if constexpr (requires(Ts a) { a.view()->StringView; })
+ return this->equals_ignoring_case(forward<Ts>(strings.view()));
+ else
+ return this->equals_ignoring_case(forward<Ts>(strings));
+ }());
+ }
+
private:
RefPtr<StringImpl> m_impl;
};