关于Format函数 format函数用于格式化字符串,但具体怎么用呢,最好详细一些,或者提供文章! 不胜感激!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 formate('as%sdd','d')使用d代替了%s。最好是看帮助,否则以后要老问别人。 function Format(const Format: string; const Args: array of const): string; 功能 返回按指定方式格式化一个数组常量的字符形式说明 这个函数是我在Delphi中用得最多的函数,现在就列举几个例子给你个直观的理解"%" [索引 ":"] ["-"] [宽度] ["." 摘要] 类型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); //连接字符串 这个在DELPHI中的HELP中有详细的说明. ━━━━━━━━━━━━━━━━━━━━━首部 function Format(const Format: string; const Args: array of const): string; $[SysUtils.pas功能 返回按指定方式格式化一个数组常量的字符形式说明 这个函数是我在Delphi中用得最多的函数,现在就列举几个例子给你个直观的理解"%" [索引 ":"] ["-"] [宽度] ["." 摘要] 类型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); //连接字符串参考 proceduer SysUtils.FmtStr例子 Edit1.Text := Format(Edit2.Text, [StrToFloatDef(Edit.3.Text, 0)]);━━━━━━━━━━━━━━━━━━━━━ 晕~~怎么贴得一样~~来源自:http://kingron.myetang.com/document/delphi/index.htmlhttp://kingron.myetang.com/document/delphi/delphi6sysutilspas.html目前我只写了四个单元的帮助~~Classes单元还没发布~~ 一个机子可以同时装两个版本的delphi 吗 数据库的完整性定义是什么? 如何用ADOQUERY+ADOCONNECTION+DBGRID从表中读出数据,显示于DBGRID中 请问Windows Media Player 控件有无类似onplaying事件? 如何实现这样的问题? 运行时老是提示 database login对话框 要我输入 user name 和 password 发声 打包的问题,高分放送。请高手们不吝赐教! 如何知道当前记录在TQUERY或TDATASET中是第几个记录??? “50人软件“。 一个基础问题:??? 急急急急急啊
功能 返回按指定方式格式化一个数组常量的字符形式
说明 这个函数是我在Delphi中用得最多的函数,现在就列举几个例子给你个直观的理解
"%" [索引 ":"] ["-"] [宽度] ["." 摘要] 类型
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; $[SysUtils.pas
功能 返回按指定方式格式化一个数组常量的字符形式
说明 这个函数是我在Delphi中用得最多的函数,现在就列举几个例子给你个直观的理解
"%" [索引 ":"] ["-"] [宽度] ["." 摘要] 类型
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); //连接字符串
参考 proceduer SysUtils.FmtStr
例子 Edit1.Text := Format(Edit2.Text, [StrToFloatDef(Edit.3.Text, 0)]);
━━━━━━━━━━━━━━━━━━━━━
来源自:
http://kingron.myetang.com/document/delphi/index.html
http://kingron.myetang.com/document/delphi/delphi6sysutilspas.html目前我只写了四个单元的帮助~~
Classes单元还没发布~~