fb:porticula NoPaste
byte_2_x
Uploader: | The_Muh |
Datum/Zeit: | 21.08.2008 20:07:48 |
declare function byte_2_x(B as ulongint) as string
function byte_2_x(B as ulongint) as string
dim KiB as ulongint
dim MiB as ulongint
dim GiB as ulongint
dim TiB as ulongint
dim PiB as ulongint
dim EiB as ulongint
dim biggest as string
dim stamp as string
if B >= 1024 then
KiB = int(B / 1024)
B -= KiB * 1024
Biggest = "KiB"
end if
if KiB >= 1024 then
MiB = int(KiB / 1024)
KiB -= MiB * 1024
Biggest = "MiB"
end if
if MiB >= 1024 then
GiB = int(MiB / 1024)
MiB -= GiB * 1024
Biggest = "GiB"
end if
if GiB >= 1024 then
TiB = int(GiB / 1024)
GiB -= TiB * 1024
Biggest = "TiB"
end if
if TiB >= 1024 then
PiB = int(TiB / 1024)
TiB -= PiB * 1024
Biggest = "PiB"
end if
if PiB >= 1024 then
EiB = int(PiB / 1024)
PiB -= EiB * 1024
biggest = "EiB"
end if
select case biggest
case "KiB":
stamp = Kib & " KiB, " & B & " Byte"
case "MiB":
stamp = Mib & "MiB, " & KiB & " KiB"
case "GiB":
stamp = Gib &"GiB, " & MiB & " MiB"
case "TiB":
stamp = Tib &"TiB, " & GiB & " GiB"
case "PiB":
stamp = Pib &"PiB, " & TiB & " TKiB"
case "EiB":
stamp = Eib &"EiB, " & PiB & " PiB"
end select
return stamp
end function
print byte_2_x(9999999999999999999)