format 函数? 看书上的format函数介绍怎么看都看不懂,大伙帮帮我好吗?能否详细点!!谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 function Format(const Format: string; const Args: array of const): string; $[SysUtils.pas功能 返回按指定方式格式化一个数组常量的字符形式"%" [索引 ":"] ["-"] [宽度] ["." 摘要] 类型Format('x=%d', [12]); //'x=12' //最普通Format('x=%3d', [12]); //'x= 12' //指定宽度Format('x=%f', [12.0]); //'x=12.00' //浮点数Format('x=%.3f', [12.0]); //'x=12.000' //指定小数Format('x=%.*f', [5, 12.0]); //'x=12.00000' //动态配置Format('x=%.5d', [12]); //'x=00012' //前面补充0Format('x=%.5x', [12]); //'x=0000C' //十六进制Format('x=%1:d%0:d', [12, 13]); //'x=1312' //使用索引Format('x=%p', [nil]); //'x=00000000' //指针Format('x=%1.1e', [12.0]); //'x=1.2E+001' //科学记数法Format('x=%%', []); //'x=%' //得到"%"S := Format('%s%d', [S, I]); //S := S + StrToInt(I); //连接字符串 函数定义: function Format(const Format: string; const Args: array of const): string;意思: 进行一种格式输出,是按const Format: string定制的格式进行输出的,如果你字符串中有变量参数呢,就使用 “%”在格式字符串const Format: string中进行占位,然后系统在输出时用你在后面的const Args: array of const(参数数组)里的值进行置换;这些东西帮助里说得很清楚的:) S := Format(%5.-d', [1]); 00001 有那位朋友开发过 JBC2360E 考勤机的接口??? 如何查找edit中有单引号的数据? 关于批处理的问题 请各路神仙讨论一下:D5、D6、D7之间到底有什么区别? 组件保存到流,再次读出来报告出错!? 一个关于DBGrid的问题 向access2000表添加记录时出错,提示:field '日期' not found 调用dos 程序文件,如何得到其返回值!!! 各位老大,拜托: 为什么在Delphi中用PasteSpecial会使目标ppt体积剧增? cgi+Kylix 急急急急~~我用image 空间放的图片,运行时候怎么不能显示出来呢??急? 我可不可以一下子追加好几条记录?
功能 返回按指定方式格式化一个数组常量的字符形式
"%" [索引 ":"] ["-"] [宽度] ["." 摘要] 类型
Format('x=%d', [12]); //'x=12' //最普通
Format('x=%3d', [12]); //'x= 12' //指定宽度
Format('x=%f', [12.0]); //'x=12.00' //浮点数
Format('x=%.3f', [12.0]); //'x=12.000' //指定小数
Format('x=%.*f', [5, 12.0]); //'x=12.00000' //动态配置
Format('x=%.5d', [12]); //'x=00012' //前面补充0
Format('x=%.5x', [12]); //'x=0000C' //十六进制
Format('x=%1:d%0:d', [12, 13]); //'x=1312' //使用索引
Format('x=%p', [nil]); //'x=00000000' //指针
Format('x=%1.1e', [12.0]); //'x=1.2E+001' //科学记数法
Format('x=%%', []); //'x=%' //得到"%"
S := Format('%s%d', [S, I]); //S := S + StrToInt(I); //连接字符串
function Format(const Format: string; const Args: array of const): string;
意思:
进行一种格式输出,是按const Format: string定制的格式进行输出的,如果你字符串中有变量参数呢,就使用 “%”在格式字符串const Format: string中进行占位,然后系统在输出时用你在后面的const Args: array of const(参数数组)里的值进行置换;这些东西帮助里说得很清楚的:)