you are passing 0 for the min and max decimal places so of course you get nothing after the decimal.
If you want a max of 3 decimal places then you need to place a 3 in that parameter.
this is just one example.
The difference also occurs with other numbers and formats.
Having to convert the numeric format into Italian, this generates errors in the app. changing the function in NumberFormat2 all the representations of the numbers change, compromising the graphic result.
@Star-Dust tell me a solution.
But i must rmodify all my Apps.
B4X:
Public Sub NumberFormatPlus(Number As Double, MinimumIntegers As Int, MaximumFractions As Int) As String
If Number=Round(Number) Then
Return $"$1.0{Number}"$
Else
Return NumberFormat(Number,MinimumIntegers,MaximumFractions)
End If
End Sub
If Number=Round(Number) Then
Return NumberFormat(Number, 1, 0)
Else
Return NumberFormat(Number,MinimumIntegers,MaximumFractions)
End If
I don't know what you are trying to do but will probably be safer to do something like:
B4X:
If Abs(Number - Round(Number)) < 0.00000001 Then
Return NumberFormat(Number, 1, 0)
Else
Return NumberFormat(Number,MinimumIntegers,MaximumFractions)
End If
If Number=Round(Number) Then
Return NumberFormat(Number, 1, 0)
Else
Return NumberFormat(Number,MinimumIntegers,MaximumFractions)
End If
I don't know what you are trying to do but will probably be safer to do something like:
B4X:
If Abs(Number - Round(Number)) < 0.00000001 Then
Return NumberFormat(Number, 1, 0)
Else
Return NumberFormat(Number,MinimumIntegers,MaximumFractions)
End If
Would solve the problem by simply setting the number of digits of integers to 1 rather than 0.
Setting it to 0 Android 11 when there are no integers does not even display zero, and it seems to me a correct behavior while previous versions when there are no digits integers displays zero
Public Sub NumberFormatPlus(Number As Double, MinimumIntegers As Int, MaximumFractions As Int) As String
Return NumberFormat(Number,Max(MinimumIntegers,1),MaximumFractions)
End Sub