Selaa lähdekoodia

LibJS: Trim non-ASCII whitespace as well in StringToNumber

This regressed in f4b3bb5.
Linus Groh 2 vuotta sitten
vanhempi
commit
c88c33dc22
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      Userland/Libraries/LibJS/Runtime/Value.cpp

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Value.cpp

@@ -527,7 +527,7 @@ static Optional<NumberParseResult> parse_number_text(StringView text)
 static Optional<Value> string_to_number(StringView string)
 {
     // 1. Let text be StringToCodePoints(str).
-    String text = string.trim_whitespace();
+    String text = Utf8View(string).trim(whitespace_characters, AK::TrimMode::Both).as_string();
 
     // 2. Let literal be ParseText(text, StringNumericLiteral).
     if (text.is_empty())