mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
AK: Make String::count not use strstr and take a StringView
This was needlessly copying StringView arguments, and was also using strstr internally, which meant it was doing a bunch of unnecessary strlen calls on it. This also moves the implementation to StringUtils to allow API consistency between String and StringView.
This commit is contained in:
parent
4e40eaf34c
commit
6d2b003b6e
Notes:
sideshowbarker
2024-07-18 04:15:09 +09:00
Author: https://github.com/IdanHo
Commit: 6d2b003b6e
Pull-request: https://github.com/SerenityOS/serenity/pull/9948
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/bgianfo ✅
5 changed files with 19 additions and 17 deletions
|
@ -71,6 +71,8 @@ Optional<size_t> find_any_of(StringView const& haystack, StringView const& needl
|
|||
String to_snakecase(const StringView&);
|
||||
String to_titlecase(StringView const&);
|
||||
|
||||
size_t count(StringView const&, StringView const& needle);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue