From aba4c9579ff8d36f739eb221e330782e5c3a5d9d Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Sat, 11 Sep 2021 01:04:08 +0300 Subject: [PATCH] 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. --- Userland/Applications/Browser/BrowserWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index 78237e5ae2..8725279a5b 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -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();