Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.7.0
-
None
-
Windows 10;
-
-
8
-
Foundation PM Staging
Description
Got this on Qt.locale("pl_PL")
For large numbers in standard notation, function Number.FromLocaleString() returns Invalid Format. The core issue seems to be that it doesn't handle well multiple separate spaces within one number
To reproduce:
Number.fromLocaleString(Qt.locale(),"9 999 998,20"); //exception Invalid Format Number.fromLocaleString(Qt.locale(),"9999 998,20"); //OK
For large numbers, the conversion also doesn't work both ways.
Minimal code to reproduce:
import QtQuick 2.15 import QtTest 1.0 TestCase { name: "NumberToLocaleString" function test_case1() { Number.fromLocaleString(Qt.locale("pl_PL"),"9 999 998,20"); //exception Invalid Format verify(false); } function test_case2() { Number.fromLocaleString(Qt.locale("pl_PL"),"9999 998,20"); //OK verify(true); } function test_case3() { var num = Number(9999998.20).toLocaleString(Qt.locale("pl_PL")); console.log(num) Number.fromLocaleString(Qt.locale(),num); //exception Invalid Format verify(true); } }