Printing leading zeros before a number
puts
"
%05d
"
%
6
#=> 00006
The above example prints up to 5 digit leading zeros
Tags:
zeros
leading
string
sprintf
format
Source:
1815hrs.txt
Published:
26-05-2012 18:15