mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 08:38:10 +00:00
AK: Add count() helper to String
This commit is contained in:
parent
f3dbfb85d9
commit
9a03e4dd73
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…
Add table
Add a link
Reference in a new issue