Problem with cents

Posted by Ptrayal on Fri 18 Nov 2011 04:45 PM — 4 posts, 16,280 views.

#0
Hello:
I'm having a problem with my dollars and cents. I'm using KaVir's generic plugin as a my base and I've hit a snag.

If I have 12 cents, it shows fine. It's when I get to single cents that it is displaying things like $10.9, not $10.09. Anyone have any thoughts on how to fix this problem?

Best Regards,
Rayal
USA Global Moderator #1
string.format("%02d",your_cents_variable)

This means "2 digits with 0s filling the rest of the space".
See http://www.cplusplus.com/reference/clibrary/cstdio/printf/ for a string.format quick reference.
Amended on Fri 18 Nov 2011 05:00 PM by Fiendish
#2
Fiendish said:


string.format("%02d",your_cents_variable)

This means "2 digits with 0s filling the rest of the space".
See http://www.cplusplus.com/reference/clibrary/cstdio/printf/
for a string.format quick reference.

In the plugin or in my code?
USA Global Moderator #3
Ptrayal said:

Fiendish said:


string.format("%02d",your_cents_variable)

This means "2 digits with 0s filling the rest of the space".
See http://www.cplusplus.com/reference/clibrary/cstdio/printf/
for a string.format quick reference.

In the plugin or in my code?

You haven't posted either. How am *I* supposed to know? I'm just telling you the general solution to the problem of wanting zero-padded numbers.