Hi to all.
I use below function to format file's size
Example if size of file is 12000 then result is 11.7 kb or 120000 is 12 Mb(if i write correct )
I use below function to format file's size
Example if size of file is 12000 then result is 11.7 kb or 120000 is 12 Mb(if i write correct )
B4X:
Sub FormatSize(Size As Float) As String
Dim unit() As String = Array As String(" Byte", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB")
If (Size == 0) Then
Return "N/A"
Else
Dim po,si As Double
Dim i As Int
i = Floor(Logarithm(Size, 1024))
po = Power(1024,i)
si = Size / po
Return si & unit(i)
End If
End Sub