Sean Russell wrote:
> 
> <posted & mailed>
> 
> 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?
> 
> Ruby also has printf.
> 
> If you're doing a single data, you can format it with %:
> 
>    out = "%05d"%20  # -> 00020

Works with multiple data items, too:

irb(main):001:0> "%s, %s!" % ["Hello", "world"]
"Hello, world!"