diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2023-04-29 10:41:25 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-30 05:48:14 +0200 |
commit | 9a03e4dd7325733a7b6928e296495fc8ca670375 (patch) | |
tree | e7d0c4932d8bc43d8b21dfc5f96cdef4f2ec4a3f /AK/String.h | |
parent | f3dbfb85d993f3af4c2335edcab678ff9da458c5 (diff) | |
download | serenity-9a03e4dd7325733a7b6928e296495fc8ca670375.zip |
AK: Add count() helper to String
Diffstat (limited to 'AK/String.h')
-rw-r--r-- | AK/String.h | 2 |
1 files changed, 2 insertions, 0 deletions
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<String> replace(StringView needle, StringView replacement, ReplaceMode replace_mode) const; ErrorOr<String> reverse() const; |