Delphi 文件大小 显示k 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;

相关阅读 >>

python4Delphi 示例应用程序在 Delphi 应用程序中运行简单的 python 脚本

Delphi 删除字符串中首个字符

Delphi adoquery查询用户是否存在

Delphi 生成指定范围和个数的不重复的随机整数

为什么编程是独一无二的职业

Delphi7 写过卡巴主动防御服务端

Delphi sysutils.strcat

Delphi中accesss实现树形结构查询系统

Delphi 单击按钮左键弹起菜单

Delphi 日期时间函数

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



打赏

取消

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

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

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

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

评论

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