I'm not very familiar with using NumberFormat() but I have to update some code written by someone else. What I need to do is this: given a decimal value (3.1 or 14.99), format the number to two decimal places. The code used to look like this:
but that started giving us errors when the numbers got bigger than 10. I changed it to this:
which works for now, but I'm looking for a way to make this work always, without having to guess how many digits there may be to the left of the decimal point. For example, in Perl I'd do this:
and it would just output the number formatted to two decimal places, without me having to worry about how big the number might be.
Any suggestions?
Code:
#NumberFormat(myVar,"_.__")#
Code:
#NumberFormat(myVar,"__.__")#
Code:
printf("%.2f",$myVar);
Any suggestions?