[fpc-devel] Format with zero padding

Marco van de Voort marcov at stack.nl
Tue Jun 20 21:57:20 CEST 2006


> Marco van de Voort wrote:
> >>> SysUtils.Format ('%.4D', Some_Int);
> >> Sounds like I found a case where 'C' is more intuitive than pascal ;-).
> > 
> > With a C mindset, yes. There a leading 0 can have meaning. In Pascal an
> > extra leading zero never has meaning.
> 
> It's a formatting string, not a number only. You think a digit *after*
> the decimal point to be used for integers in front of the whole number
> is more intuitive ?

Perfect? no. Better than leading 0? yes.

Leading zeroes that have meaning are an artificial construct. Keep in mind
that C users might be aware of deviant use (they are octal numbers as
literals), but Pascal users most probably wouldn't think twice.



More information about the fpc-devel mailing list