diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-09-11 01:04:08 +0300 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2021-09-11 20:36:43 +0300 |
commit | aba4c9579ff8d36f739eb221e330782e5c3a5d9d (patch) | |
tree | 99e7e84b7e38444144cd2ee772424b3ccda7b12f /Userland/Applications | |
parent | 6d2b003b6e652e807a1021151cccf41a396f18b7 (diff) | |
download | serenity-aba4c9579ff8d36f739eb221e330782e5c3a5d9d.zip |
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.
Diffstat (limited to 'Userland/Applications')
-rw-r--r-- | Userland/Applications/Browser/BrowserWindow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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(); |