1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:37:37 +00:00

AK+Everywhere: Consolidate String::index_of() and String::find()

We had two functions for doing mostly the same thing. Combine both
of them into String::find() and use that everywhere.

Also add some tests to cover basic behavior.
This commit is contained in:
Andreas Kling 2021-05-24 11:50:46 +02:00
parent 875a2cbb71
commit de395a3df2
12 changed files with 36 additions and 30 deletions

View file

@ -297,7 +297,7 @@ Optional<Image::Symbol> Image::find_demangled_function(const String& name) const
if (symbol.is_undefined())
return IterationDecision::Continue;
auto demangled = demangle(symbol.name());
auto index_of_paren = demangled.index_of("(");
auto index_of_paren = demangled.find('(');
if (index_of_paren.has_value()) {
demangled = demangled.substring(0, index_of_paren.value());
}