%.createfmt(33分)

  • 主题发起人 千中元
  • 开始时间

千中元

Unregistered / Unconfirmed
GUEST, unregistred user!
raise ERangeError.CreateFmt(
'%d is not within the valid range of %d..%d',
[Result, Min, Max]);
1)%的使用让我想起c语言。D5里还有类似的%比如%F什么的么?
2)createfmt在帮助里找不到
 
怎么没有?是不是你的 帮助文件没更新?
Instantiates an instance of an exception with a formatted message string.

constructor CreateFmt (const Msg: string
const Args: array of const)

Description

Call CreateFmt to construct an exception with a formatted message string. Msg is a string constant containing format specifiers to be replaced with values from Args. Args is an array of constants containing values to format according to format specifiers in Msg, and insert into Msg. CreateFmt calls the Format function to transform Msg with the values in Arg.
 
1)帮助->索引->format strings
没有再来问
2)已灌,略
 
Format('%*.*f', [8, 2, 123.456])

is the same as

Format('%8.2f', [123.456]).
看不懂。谁有帮助的汉化?
 
同感,我对哪个也不太清楚
 
今天花了300,眼看要亏空了,赚点吧。

这两句是等效的。

例如:
caption := Format('%8.2f', [123.456])
//or
caption := Format('%*.*f', [8, 2, 123.456])



// caption is 123.46
是格式化数据的。类似 c语言。

'%8.2f' 是要显示数据的格式:宽度=8,小数位:2, f:符点数。
'%*.*f' 同上,前一个* <->8, 后一*<->2 , f:符点数
 
sorry : 浮点数
 
可能你的小数位数 >宽度-2
 
差点分错了.呵呵
 

Similar threads

回复
0
查看
819
不得闲
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
顶部