Android Question NumberFormat2() with decimalseparator accroding to locale?

fredo

Well-Known Member
Licensed User
Longtime User
According to the documentation NumberFormat2() returns a string with a decimal separator and grouping characters.

B4X:
NumberFormat2(12345.67, 0, 3, 3, True) = 12,345.670

While localizing a large project I need to have the comma and dot according to the devices active locale, but NumberFormat2() delivers the same for countries US and DE.

In order to avoid NumberFormatExceptions (de_DE expects "12.345,670") I could change the characters on the fly via .replace(",", ".") .

But before growing performance issues (e.g. fast scrolling of ULV with 20 views per Layoutpanel) I would like to know if there is an Android function I could call via reflection.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top