Logo

Programming-Idioms

History of Idiom 156 > diff from v10 to v11

Edit summary for version 11 by bert:
New Java implementation by user [bert]

Version 10

2018-09-04, 12:42:57

Version 11

2019-09-26, 18:06:28

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
String.format("%03d", i);