mirror of
https://github.com/RGBCube/serenity
synced 2025-06-28 21:32:07 +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:
parent
875a2cbb71
commit
de395a3df2
12 changed files with 36 additions and 30 deletions
|
@ -1772,7 +1772,7 @@ RefPtr<AST::Node> Parser::parse_bareword()
|
|||
String username;
|
||||
RefPtr<AST::Node> tilde, text;
|
||||
|
||||
auto first_slash_index = string.index_of("/");
|
||||
auto first_slash_index = string.find('/');
|
||||
if (first_slash_index.has_value()) {
|
||||
username = string.substring_view(1, first_slash_index.value() - 1);
|
||||
string = string.substring_view(first_slash_index.value(), string.length() - first_slash_index.value());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue