mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
AK: Add String{View,}::find(StringView)
I personally mistook `find_first_of(StringView)` to be analogous to this so let's add a `find()` method that actually searches the string.
This commit is contained in:
parent
4fa8435310
commit
39442e6d4f
8 changed files with 70 additions and 11 deletions
|
@ -469,4 +469,14 @@ String String::vformatted(StringView fmtstr, TypeErasedFormatParams params)
|
|||
return builder.to_string();
|
||||
}
|
||||
|
||||
Optional<size_t> String::find(char c) const
|
||||
{
|
||||
return find(StringView { &c, 1 });
|
||||
}
|
||||
|
||||
Optional<size_t> String::find(const StringView& view) const
|
||||
{
|
||||
return StringUtils::find(*this, view);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue