Hello all -
I have sprintf formatting a number that goes on a report. I'm using
%05.2f to change 5.5 to 05.50, for example. However, I'm having a
problem with negative values -- I get -3.43, for example, because with
the sign, the whole length of the string is 5 characters.
I want a number that always has the tens place and the hundredths
decimal place, and the sign only when the number is negative. For
example:
05.50
-01.22
55.07
-80.00
00.40
How do I get what I want? Obviously, I don't really understand the
syntax of sprintf. Thanks!
I have sprintf formatting a number that goes on a report. I'm using
%05.2f to change 5.5 to 05.50, for example. However, I'm having a
problem with negative values -- I get -3.43, for example, because with
the sign, the whole length of the string is 5 characters.
I want a number that always has the tens place and the hundredths
decimal place, and the sign only when the number is negative. For
example:
05.50
-01.22
55.07
-80.00
00.40
How do I get what I want? Obviously, I don't really understand the
syntax of sprintf. Thanks!
Comment