Reported by Ken Henke; checked by Reinier Sterkenburg
In the past I've accomplished zero-padding by using the FORMAT statement
like so:
nTemp:= 3;
sTemp:= Format('%.6d', [nTemp])
{sTemp now equals '000003'}
But, when I tried to do that on a field with 16 digits, it seems to ignore
the specifier. For example:
nTemp:= 3;
sTemp:= Format('%.16d', [nTemp])
{sTemp now equals '3' instead of '0000000000000003'}
This is a bug because the FORMAT specifier '%.16d' should be
padding with zeros. There isn't a documented reason why this
shouldn't work on specifiers larger than 15.
Borland's Chuck Jazdzewski commented on this (26 Feb 99):
This is a documentation bug. Ordinals of 32 bits or less are limited
to 16 digits of precision. Int64 gets 32 digits.
Miken Bean pointed out that (28 Feb 2000):
This bug has not been fully fixed in version 5.0 as listed on the web site.
The format function works correctly for a format specifier of "%.16d" however,
if fails as soon as the precision specifier reaches 17. Chuck Jazdzewski
comment that one should use Int64 to get 32 digits of precision does not
seem to work.
RS, 10 June 2001:
Miken Bean's remark is accurate; under Delphi 5.01 as well as under Kylix |