用Format格式化数字
Format('x=%d', [11]); //'x=11' //最普通
Format('x=%3d', [11]); //'x= 11' //指定宽度
Format('x=%.5d', [11]); //'x=00011' //前面补充0
S := Format('%s%d', [S, I]); //S := S + StrToInt(I); //连接字符串
Format('x=%1:d%0:d', [11, 13]); //'x=1311' //使用索引
Format('x=%f', [11.0]); //'x=11.00' //浮点数
Format('x=%.3f', [11.0]); //'x=11.000' //指定小数
Format('x=%.*f', [5, 11.0]); //'x=11.00000' //动态配置
Format('x=%.5x', [11]); //'x=0000B' //十六进制
Format('x=%p', [nil]); //'x=00000000' //指针
Format('x=%1.1e', [11.0]); //'x=1.2E+001' //科学记数法
Format('x=%%', []); //'x=%' //得到"%"
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.16214299201965 seconds