Commit f2aba4fc authored by Florian Sattler's avatar Florian Sattler Committed by Commit Bot

[Intl] Refactored find calls to use char.

String find has a faster overload for char, hence, we should pass a char
instead of a string where possible. Fixing clang-tidy warning.

Bug: v8:8015
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I49611d84bfb195992b6e2de538a726a8654b7b71
Reviewed-on: https://chromium-review.googlesource.com/1209348
Commit-Queue: Florian Sattler <sattlerf@google.com>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55713}
parent 6027ec03
......@@ -936,7 +936,7 @@ bool IsStructurallyValidLanguageTag(Isolate* isolate,
// is not valid and would fail LANGUAGE_TAG_RE test.
size_t pos = 0;
std::vector<std::string> parts;
while ((pos = locale.find("-")) != std::string::npos) {
while ((pos = locale.find('-')) != std::string::npos) {
std::string token = locale.substr(0, pos);
parts.push_back(token);
locale = locale.substr(pos + 1);
......@@ -1195,7 +1195,7 @@ void Intl::ParseExtension(Isolate* isolate, const std::string& extension,
size_t start = 3;
size_t end;
do {
end = extension.find("-", start);
end = extension.find('-', start);
size_t length =
(end == std::string::npos) ? extension.length() - start : end - start;
std::string element = extension.substr(start, length);
......@@ -1230,7 +1230,7 @@ MaybeHandle<String> Intl::StringLocaleConvertCase(Isolate* isolate,
std::string requested_locale = requested_locales.size() == 0
? Intl::DefaultLocale(isolate)
: requested_locales[0];
size_t dash = requested_locale.find("-");
size_t dash = requested_locale.find('-');
if (dash != std::string::npos) {
requested_locale = requested_locale.substr(0, dash);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment