Android Question double decimal

Erel

Administrator
Staff member
Licensed User
B4X:
Sub FormatNumber (i As Int) As String
   Dim n As String = NumberFormat2(i, 0, 0, 0, False)
   Dim sb As StringBuilder
   sb.Initialize
   Dim NextGroup As Int = 3
   For i = 0 To n.Length - 1
       If NextGroup = 0 Then
           sb.Insert(0, ",")
           NextGroup = 2
       End If
       sb.Insert(0, n.CharAt(n.Length - 1 - i))
       NextGroup = NextGroup - 1
   Next
   Return sb.ToString
End Sub
 

Kiran Raotole

Active Member
Licensed User
B4X:
Sub FormatNumber (i As Int) As String
   Dim n As String = NumberFormat2(i, 0, 0, 0, False)
   Dim sb As StringBuilder
   sb.Initialize
   Dim NextGroup As Int = 3
   For i = 0 To n.Length - 1
       If NextGroup = 0 Then
           sb.Insert(0, ",")
           NextGroup = 2
       End If
       sb.Insert(0, n.CharAt(n.Length - 1 - i))
       NextGroup = NextGroup - 1
   Next
   Return sb.ToString
End Sub
Thanks.
 
Top