Bug? NumberFormat (Bug) vs. NumberFormat2 (ok)

Pfriemler

Member
Licensed User
Longtime User
Hi guys,
for reuse of some eVB3-Code I created a Function namend
B4X:
Sub ZeroNum(value As Object, digits As Int) As String
    Dim e As String
    e = NumberFormat(value,digits,0)
    Return e
End Sub
This is to get a string with leading zeros from any value.

But what happens:
ZeroNum(2,2) > "02" = ok
ZeroNum(2,1) > "2" = ok
ZeroNum(2,0) > "2" ... hey, just as ZeroNum(12345,2) should lead to "12345", it's ok.
ZeroNum(2,4) > "0,002" - instead of expected "0002"
ZeroNum(2,6) > 000,002 - instead of "000002"

If I change the Code using Numberformat2,
B4X:
    e = NumberFormat2(value,digits,0,0,False)
everything comes up fine.

As the first 3 params in the tooltip help are identical (value, MinimumIntegers, MaximumFractions), I think this is a fat bug, isn't it?

B4A version is 3.20.
 

Pfriemler

Member
Licensed User
Longtime User
Aargh ... is the "," a simple grouping (which I never saw before with a three digit string) - not a fraction?
In Germany, 0,002 means 0.002 ...
 
Top