[fpc-devel] Format with zero padding

Vinzent Hoefler JeLlyFish.software at gmx.net
Tue Jun 20 14:16:47 CEST 2006


On Tuesday 20 June 2006 11:39, Micha Nelissen wrote:
> Vinzent Hoefler wrote:
> > On Tuesday 20 June 2006 10:44, Micha Nelissen wrote:
> >> How can I zero-pad using Format ?
> >
> > RTFM. :-)
> >
> > SysUtils.Format ('%.4D', Some_Int);
>
> Sounds like I found a case where 'C' is more intuitive than pascal
> ;-).

As if format strings were intuitive at all. :-)

I'd call "Zero_Pad (Some_Int, 4)" definitely more intuitive.

> Seriously, isn't "Format" an imitation of C's printf ?

Apart from the fact, that you can get run time type checking? Yeah, I 
suppose so.

> At least they
> are very similar, but on this detail (and maybe some others as well)
> they are different.

Well, let's assume it's due to Delphi-compatibility. Probably Borland 
decided to do it differently just for the fun of it. ;-)


Vinzent.




More information about the fpc-devel mailing list