[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Number formatting

Ball, Donald A Jr (Library)

5/31/2007 4:12:00 PM

> folks - can't quite figure this one out...
>
> foo = 5
> bar = 10
>
>
> basically - when i go to print out the numbers - i want to
> format 'foo'
> with a leding zero so that it reads '05' and is aesthetically
> pleasing when compared to a double-digit number - such as bar: '10'.

sprintf('%02d', foo)

- donald