My snippet is helpful when formatting data sizes.
[pascal]
{ .: FormatSize :. }
function FormatSize(const Size: Integer): String;
const
KB = 1024;
MB = KB * KB;
GB = MB * KB;
begin
case Size of
0..KB -1: Result := IntToStr(Size) + ' B';
KB..MB -1: Result := Format('%.2f KB', [Size / KB]);
MB..GB -1: Result := Format('%.2f MB', [Size / MB]);
else
Result := Format('%.2f GB', [Size / GB]);
end;
end;
[/pascal]