Explorar o código

LibJS: Make PluralRules use the new double parser

davidot %!s(int64=2) %!d(string=hai) anos
pai
achega
d66bfcc3f4
Modificáronse 1 ficheiros con 1 adicións e 3 borrados
  1. 1 3
      Userland/Libraries/LibJS/Runtime/Intl/PluralRules.cpp

+ 1 - 3
Userland/Libraries/LibJS/Runtime/Intl/PluralRules.cpp

@@ -21,9 +21,7 @@ PluralRules::PluralRules(Object& prototype)
 ::Locale::PluralOperands get_operands(String const& string)
 {
     // 1.Let n be ! ToNumber(s).
-    char* end { nullptr };
-    auto number = strtod(string.characters(), &end);
-    VERIFY(!*end);
+    auto number = string.to_double(AK::TrimWhitespace::Yes).release_value();
 
     // 2. Assert: n is finite.
     VERIFY(isfinite(number));