mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-01 15:18:06 +00:00
Browser: Use String::count instead of String::replace(X, X, true)
There's no need to create a new String just to count the amount of occurrences of a substring.
This commit is contained in:
parent
6d2b003b6e
commit
aba4c9579f
Notes:
sideshowbarker
2024-07-18 04:15:05 +09:00
Author: https://github.com/IdanHo
Commit: aba4c9579f
Pull-request: https://github.com/SerenityOS/serenity/pull/9948
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/bgianfo ✅
1 changed files with 1 additions and 1 deletions
|
@ -280,7 +280,7 @@ void BrowserWindow::build_menus()
|
|||
return;
|
||||
}
|
||||
|
||||
int argument_count = search_engine.replace("{}", "{}", true);
|
||||
auto argument_count = search_engine.count("{}"sv);
|
||||
if (argument_count != 1) {
|
||||
GUI::MessageBox::show(this, "Invalid format, must contain '{}' once!", "Error", GUI::MessageBox::Type::Error);
|
||||
m_disable_search_engine_action->activate();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue