On Sun, 17 Feb 2002, David Corbin wrote:

> In C, people use printf to format data nicely for display.  In Java,
> it's NumbeFormat, DateFormat, etc.
>
> What is the best  way to do this in Ruby?

If you want sprintf like formatting then % might be useful e.g. (lifting
from Programming Ruby's Built In Classes section)

[mike@ratdog mike]$ irb
irb(main):001:0> "%05d" % 123
"00123"
irb(main):002:0> "%-5s: %08x" % [ 'ID', self.id ]
"ID   : 200f5670"

Hope this helps,

Mike

-- 
mike / stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       | GPG PGP Key      1024D/059913DA
mike / starnix.com                   | Fingerprint      0570 71CD 6790 7C28 3D60
http://www.starnix.com/            |                  75D2 9EC4 C1C0 0599 13DA