From 9a03e4dd7325733a7b6928e296495fc8ca670375 Mon Sep 17 00:00:00 2001 From: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> Date: Sat, 29 Apr 2023 10:41:25 -0400 Subject: AK: Add count() helper to String --- AK/String.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AK/String.h b/AK/String.h index 72f3650469..b69cf95fd5 100644 --- a/AK/String.h +++ b/AK/String.h @@ -138,6 +138,8 @@ public: // Returns a StringView covering the full length of the string. Note that iterating this will go byte-at-a-time, not code-point-at-a-time. [[nodiscard]] StringView bytes_as_string_view() const; + [[nodiscard]] size_t count(StringView needle) const { return StringUtils::count(bytes_as_string_view(), needle); } + ErrorOr replace(StringView needle, StringView replacement, ReplaceMode replace_mode) const; ErrorOr reverse() const; -- cgit v1.2.3