From 0396b6da82c34dc94dd9dc8248df536e8b3792c4 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Fri, 10 Jun 2022 18:52:14 +0200 Subject: [PATCH] AK: Add StringView operator==(char) --- AK/StringView.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/AK/StringView.h b/AK/StringView.h index f08ac13525f..1ec0ec20228 100644 --- a/AK/StringView.h +++ b/AK/StringView.h @@ -227,6 +227,11 @@ public: return *cp == '\0'; } + constexpr bool operator==(char const c) const + { + return m_length == 1 && *m_characters == c; + } + constexpr bool operator!=(char const* cstring) const { return !(*this == cstring);