Assign to the string s the value of the integer i in 3 decimal digits. Pad with zeros if i < 100. Keep all digits if i ≥ 1000.
let s = format!("{:03}", i);
(def s (format "%03d" i))
string s = string.Format("{0:000}",i);
import std.format : format;
string s = format("%03d", i);
var s = i.toString().padLeft(3,'0');
write (unit=s,fmt='(I0.3)') i
import "fmt"
s := fmt.Sprintf("%03d", i)
let s = i.toString(); if(i<100) s = ('00'+i).slice(-3);
String s = String.format("%03d", i);
import static java.text.NumberFormat.getIntegerInstance; import java.text.NumberFormat;
NumberFormat f = getIntegerInstance(); f.setMinimumIntegerDigits(3); f.setGroupingUsed(false); String s = f.format(i);
String s = "%03d".formatted(i);
string.format("%03d", i)
$s = sprintf('%03d', $i);
s := format('%.3d',[i]);
my $s = sprintf '%03d', $i;
s = format(i, '03d')
s = "%03d" % i
No security, no password. Other people might choose the same nickname.