Logo

Programming-Idioms

History of Idiom 156 > diff from v1 to v2

Edit summary for version 2 by Bart:
New Pascal implementation by user [Bart]

Version 1

2017-03-16, 13:10:41

Version 2

2017-03-18, 16:32:00

Idiom #156 Format integer with zero-padding

Assign to string s the value of integer i in 3 decimal digits. Pad with zeros if i < 100. Keep all digits if i1000.

Idiom #156 Format integer with zero-padding

Assign to string s the value of integer i in 3 decimal digits. Pad with zeros if i < 100. Keep all digits if i1000.

Extra Keywords
pad leading fixed width
Extra Keywords
pad leading fixed width
Code
s := format('%.3d',[i]);