delphi 字节数转换为KB或MB字符串

2018-10-30

//delphi 字节数转换为KB或MB字符串
function BytesToStr(iBytes: Integer): String;
var
iKb: Integer;
begin
iKb := Round(iBytes / 1024);
if iKb > 1000 then
Result := Format(‘%.2f MB‘, [iKb / 1024])
else
Result := Format(‘%d KB‘, [iKb]);
end;

阅读26