Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
(def s (format "%03d" i))
write (unit=s,fmt='(I0.3)') i
This assumes that s is long enough.
let s = i.toString();
if(i<100)
s = ('00'+i).slice(-3);
NumberFormat f = getIntegerInstance();
f.setMinimumIntegerDigits(3);
f.setGroupingUsed(false);
String s = f.format(i);
String s = "%03d".formatted(i);
string.format("%03d", i)
s := format('%.3d',[i]);
my $s = sprintf '%03d', $i;
s = '%03d' % i
s = "%03d" % i