社区
语言基础/算法/系统设计
帖子详情
Format 函数
experience
2002-11-17 09:30:18
加精
谁有告诉我有关格式化字符串Format函数的参数说明,最好能举几个例子,给些代码。比如何对拉开的距离填充0
Format('%8d',[12]);`
...全文
24
3
打赏
收藏
Format 函数
谁有告诉我有关格式化字符串Format函数的参数说明,最好能举几个例子,给些代码。比如何对拉开的距离填充0 Format('%8d',[12]);`
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
wanderung
2002-11-17
打赏
举报
回复
多几个空格或者制表符不可以吗?
Nizvoo
2002-11-17
打赏
举报
回复
F1 ha
王集鹄
2002-11-17
打赏
举报
回复
//from
http://zswang.51.net/document/zsdoc02.txt
━━━━━━━━━━━━━━━━━━━━━
首部 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)]);
━━━━━━━━━━━━━━━━━━━━━
首部 procedure FmtStr(var Result: string; const Format: string; const Args: array of const); $[SysUtils.pas
功能 按指定方式格式化一个数组常量的字符形式返回
说明 <参见Format>
参考 function SysUtils.FormatBuf;function System.Length;function System.SetLength
例子 <参见Format>
━━━━━━━━━━━━━━━━━━━━━
首部 function StrFmt(Buffer, Format: PChar; const Args: array of const): PChar; $[SysUtils.pas
功能 返回按指定方式格式化一个数组常量的字符指针形式
说明 如果Buffer和Format其中只要有一个为nil则返回nil
参考 function SysUtils.FormatBuf
例子 <参见Format>
━━━━━━━━━━━━━━━━━━━━━
首部 function StrLFmt(Buffer: PChar; MaxBufLen: Cardinal; Format: PChar; const Args: array of const): PChar; $[SysUtils.pas
功能 返回按指定方式和长度格式化一个数组常量的字符指针形式
说明 StrLFmt(vBuffer, 6, '%d|12345', [1024]) = '1024|1';
参考 function SysUtils.FormatBuf
例子 <参见Format>
━━━━━━━━━━━━━━━━━━━━━
首部 function FormatBuf(var Buffer; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: array of const): Cardinal; $[SysUtils.pas
功能 返回按指定方式格式化一个数组常量到缓冲区Buffer中
说明 <NULL>
参考 <NULL>
例子 <参见Format>
━━━━━━━━━━━━━━━━━━━━━
首部 function WideFormat(const Format: WideString; const Args: array of const): WideString; $[SysUtils.pas
功能 返回按指定方式格式化一个数组常量的多字节字符形式
说明 <NULL>
参考 procedure SysUtils.WideFmtStr
例子 <参见Format>
━━━━━━━━━━━━━━━━━━━━━
首部 procedure WideFmtStr(var Result: WideString; const Format: WideString; const Args: array of const); $[SysUtils.pas
功能 按指定方式格式化一个数组常量的多字节字符形式返回
说明 <NULL>
参考 function SysUtils.WideFormatBuf
例子 <参见Format>
━━━━━━━━━━━━━━━━━━━━━
首部 function WideFormatBuf(var Buffer; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: array of const): Cardinal; $[SysUtils.pas
功能 返回按指定方式格式化一个数组常量到缓冲区Buffer中
说明 <NULL>
参考 <NULL>
例子 <参见Format>
━━━━━━━━━━━━━━━━━━━━━
PowerBI系列之DAX
函数
专题
数据格式控制:%、$、千位分隔符、小数位、日期格式
Format
函数
自定义数据格式 Convert
函数
做数据类型转换 解决中文数字单位 万 的显示问题 Date和DT
函数
定义固定日期值 显示和隐藏列 DAX代码分析器 阅读DAX表达式...
python的
format
函数
的用法及实例
目录1.
format
函数
的语法及用法(1)语法:'{}'.
format
()(2)用法:用于格式化字符串。可以接受无限个参数,可以指定顺序。返回结果为字符串。2.实例(1)不设置位置,按默认顺序(从左到右)输出。(2)指定位置(3...
DATE_
FORMAT
函数
用法
DATE_
FORMAT
函数
用法 一、在oracle中,当想把字符串为‘2011-09-20 08:30:45’的格式转化为日期格式,我们可以使用oracle提供的to_date
函数
。 sql语句为: SELECT to_date('2011-09-20 08:30:45', 'yyyy-MM-dd hh...
python中
format
函数
python中
format
函数
用于字符串的格式化 通过关键字 1. print('{name}在{option}'.
format
(name="谢某人",option="写代码")) 结果:谢某人在写代码 通过位置 1. print('name={} path={}'.
format
('zhangsan', ...
python中
format
函数
作用_Python代码中
format
函数
具有哪些功能呢?
摘要:下文讲述Python代码中
format
函数
的功能说明,如下所示:
format
函数
功能说明
format
函数
功能:用于格式化字符串
format
函数
语法:
format
采用{} 和 : 来代替以前的 %-------注意事项------
format
函数
可接收不限个数的...
语言基础/算法/系统设计
16,748
社区成员
33,247
社区内容
发帖
与我相关
我的任务
语言基础/算法/系统设计
Delphi 语言基础/算法/系统设计
复制链接
扫一扫
分享
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章