Code: Alles auswählen
Procedure.s ByteHeinz(wert.q)
   Protected anzahl.l, swert.s, temp.d, lokwert.q
   
   lokwert = wert
   anzahl = Int(Log(lokwert)/Log(2))
   Debug anzahl
   anzahl = anzahl - (anzahl % 10)
   Debug anzahl
   Debug lokwert
   Debug Pow(2, anzahl)
   temp = lokwert/Pow(2, anzahl)
   Debug temp
   swert = StrD(temp, 1)
   Select anzahl
    Case 10
      swert + " KB"
    Case 20
      swert + " MB"
    Case 30
      swert + " GB"
    Case 40
      swert + " TB"
    Case 50
      swert + " PB"
    Case 60
      swert + " EB"
   EndSelect
   ProcedureReturn swert
EndProcedure
Debug ByteHeinz(100000)
Gruß Karl

