Einzelnen Beitrag anzeigen

Benutzerbild von mirage228
mirage228

Registriert seit: 23. Mär 2003
Ort: Münster
3.750 Beiträge
 
Delphi 2010 Professional
 
#3

Re: Byte in Mega- und Kilobyte umwandeln

  Alt 8. Mai 2005, 15:36
Ich werfe mal diese Funktion in den Raum:

Delphi-Quellcode:
// by Luckie
function FormatDiskSpace(DiskSpace: Int64): string;
begin
  case DiskSpace of
    0..1023: Result := Format('%d Byte', [DiskSpace]);
    1024..1048575: Result := Format('%2n KB', [DiskSpace / 1024]);
    1048576..1073741823: Result := Format('%2n MB', [DiskSpace / 1024 / 1024]);
  else
    Result := Format('%2n GB', [DiskSpace / 1024 / 1024 / 1024]);
  end;
end;
mfG
mirage228
David F.

May the source be with you, stranger.
PHP Inspection Unit (Delphi-Unit zum Analysieren von PHP Code)
  Mit Zitat antworten Zitat