Homepage › Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Anyone got a zero fill (left) tcl proc or fragment? › Re: Thanks all!
June 3, 2005 at 7:44 pm
#56742
Rob Galino
Participant
set xlateOutVals [format “%06s” $xlateInVals]
Works like a charm, zero fills when MRN is 6 or less, does nothing if 6 or more… Used “s” (string) instead of “d” as the “d” would output funky numbers if the MRN was already leading with zeros, see below…
hcitcl>set x 0012
hcitcl>set y [format “%06d” $x]
hcitcl>echo $y
000010
hcitcl>set x 0012
hcitcl>set y [format “%06s” $x]
hcitcl>echo $y
000012