Logo

Programming-Idioms

History of Idiom 156 > diff from v17 to v18

Edit summary for version 18 by misha:
New Clojure implementation by user [misha]

Version 17

2019-11-02, 22:30:56

Version 18

2020-04-29, 11:08:25

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
(format "%03d" x)
Doc URL
https://clojuredocs.org/clojure.core/format