小编use*_*813的帖子

How to get a message from compiler when incorrect string format is used

Here is a piece of Delphi code that the compiler perfectly compiles :

Var S: String;

Begin
 S := Format('%s  %s', ['Hello']);
....
Run Code Online (Sandbox Code Playgroud)

But on execution it raises an exception, of course there are two argument in the left string, and only one in the brackets...

Is there a way to have this error checked by the compiler and to be displayed at least as a warning, or better fatal error?

delphi string formatting

4
推荐指数
1
解决办法
195
查看次数

标签 统计

delphi ×1

formatting ×1

string ×1