delphi SizeToStr 文件大小转换KB MB GB TB


本文整理自网络,侵删。

 
function SizeToStr(Size: int64): string;
  const
    K = int64(1024);
    M = K * K;
    G = K * M;
    T = K * G;
  begin
    if size < K then
      Result := Format('%d bytes', [size])
    else if size < M then
      Result := Format('%f KB', [size / K])
    else if size < G then
      Result := Format('%f MB', [size / M])
    else if size < T then
      Result := Format('%f GB', [size / G])
    else
      Result := Format('%f TB', [size / T]);
  end;

相关阅读 >>

Delphi2007 读取得unicode文本

Delphi winapi: windowfrompoint- 获取指定点所在窗口的句柄

Delphi xe5 android实现繁体字到简体字的转换函数

floattostr 将“浮点型”转换成“字符型”

Delphi 在ie上增添一个按钮

Delphi 执行控制台(console)程序获取返回结果

Delphi getdir 获取指定驱动器的当前路径名

Delphi得到cpu的序列号

Delphi格式化输出函数

Delphi 快速读取txt 指定行的数据

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...