Log(NumberFormat(1,0,2))
Log(NumberFormat(0.5,1,2))
Come risultato mi da "0.5" io voglio ottenere "0.50". Mi deve aggiungere lo zero se non c'è la seconda cifra dei centesimie questo per i centesimi:
B4X:Log(NumberFormat(0.5,1,2))
NumberFormat2 (Number AsDouble, MinimumIntegers AsInt, MaximumFractions AsInt, MinimumFractions AsInt, GroupingUsed AsBoolean) AsString
Converts the specified number to a string.
The string will include at least Minimum Integers, at most Maximum Fractions digits and at least Minimum Fractions digits.
Con questa risolvi. Il quarto parametro è quello che ti serve. Impostalo a 2.
'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub format(Amount As String) As String
Dim Amount As String = NumberFormat2(Amount, 1, 2, 2, True)
Dim Value As String
Amount = Amount.Replace(".", " ") ' removes the '.'
Amount = Amount.Replace(",", ".") ' replaces ',' by '.'
Amount = Amount.Replace(" ", ",")
Value = Amount
Return "€" & " " & Value
End Sub