开发者

Is there any .NET string.format compatible function for Delphi win32?

开发者 https://www.devze.com 2023-03-05 12:03 出处:网络
Is there any .NET string.format compatible function for Delphi Win32 ? I want to use it\'s argument order syntax.

Is there any .NET string.format compatible function for Delphi Win32 ?

I want to use it's argument order syntax.

I found one at delphi3000.com, but it's pretty simple and without supporting number precition, etc.

Don't you know any better open-source implementa开发者_运维百科tion ?

Thanks.


Use SysUtils.Format.

It also supports argument order syntax as string.format in .Net does.

You can change argument order like following example.

Format('%1:s - %0:d', [7, 'Text'])


As I was a C programmer, I thought SysUtils.Format was just like printf in C.

But SysUtils.Format is not just like "printf" and it's more powerful as RRUZ & Cosmin Prund taught me in the comments above. (I should have checked help ;-)

I wanted .Net's string.format mainly because I wanted to use it's famous argument order syntax.

Argument order syntax is useful especially for translating message text into languages (like English to Japanese), but I don't need .Net compatibility.

If you had to port .Net's code to Delphi win32, or you are very familiar with .Net's format syntax, these library would be useful if exists, but it isn't in my case.

0

精彩评论

暂无评论...
验证码 换一张
取 消