mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Add count() helper to String
This commit is contained in:
parent
f3dbfb85d9
commit
9a03e4dd73
Notes:
sideshowbarker
2024-07-17 12:02:22 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/9a03e4dd73 Pull-request: https://github.com/SerenityOS/serenity/pull/18573
1 changed files with 2 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue