<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

or you can use printf like you would in C:

   printf "Hello, my name is %s and I am %3.2f years old", "Boogerhead", 5.7
   # -> "Hello, my name is Boogerhead and I am 5.70 years old"

(you also have sprintf in Ruby, as well)

-- 
 |..  I don't brake.
<|>   
/|\   
/|    
 |