Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PERL

perl leading zeros formatting sprintf

# Format number with up to 8 leading zeroes
my $result = sprintf("%08d", $number);

# Round number to 3 digits after decimal point
my $rounded = sprintf("%.3f", $number);
Source by perldoc.perl.org #
 
PREVIOUS NEXT
Tagged: #perl #leading #zeros #formatting #sprintf
ADD COMMENT
Topic
Name
6+6 =