Public Sub TestFormatter
Dim out As String
out = out & CRLF & SetFormmatter(12345.678, 2)
out = out & CRLF & SetFormmatter(3.45, 2)
out = out & CRLF & SetFormmatter(123, 2)
out = out & CRLF & SetFormmatter(2456000.3, 2)
out = out & CRLF & SetFormmatter(0, 2)
out = out & CRLF & SetFormmatter(-1, 2)
Log(out)
End Sub
Public Sub SetFormmatter(Value As Double, Decimal As Int) As String
Dim DataFormatter As B4XFormatter
DataFormatter.Initialize
DataFormatter.GetDefaultFormat.MaximumFractions = Decimal
DataFormatter.GetDefaultFormat.MinimumFractions = Decimal
Return DataFormatter.Format(Round2(Value,2))
End Sub