format函数的使用
来源:互联网 发布:淘宝干货软件 编辑:程序博客网 时间:2024/05/11 19:07
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=%8.2f'[12.0]) // 'x= 12.00' ;
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); //连接字符串
功能 返回按指定方式格式化一个数组常量的字符形式
说明 这个函数是我在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=%8.2f'[12.0]) // 'x= 12.00' ;
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); //连接字符串
- format函数的使用
- format函数的使用
- Delphi的Format函数使用
- C++ Format 函数的使用
- string中Format函数的使用
- VB格式输出函数Format的使用
- 有用的Format函数
- Format函数的用法
- to_char的format 函数
- FORMAT函数的解释
- Format函数的用法
- VBA的Format函数
- python的format函数
- python的format函数
- python的format函数
- python的format函数
- MFC的Format函数
- format函数的用法(Delphi)Format
- 今日学习 (基于Dot Net平台的企业级应用程序的架构设计)(4 月5日)
- 数据库连接问题的总结
- 今日学习 (使用.NET Remoting 建立分布式应用程序(一))(4月6日)
- 优秀系统集成工程师应具备哪些专业知识
- 4.8
- format函数的使用
- 面向对象的程序(http://blog.csdn.net/qi_jianzhou/archive/2006/03/31/646124.aspx)
- IM市场:美丽泡沫日渐消散
- 我经常查看的网站
- 吐血总结关于找工作的20条经验(转自csdn论坛)
- 让Apache支持ASP.NET
- SQL server安装失败解决办法
- .NET环境下有关打印页面设置、打印机设置、打印预览对话框的实现
- NET环境下有关打印页面设置、打印机设置、打印预览对话框的应用(二)