2006/5/29, Peter Szinek <peter / rubyrailways.com>:
> Hello all,
>
> I need a function which takes a number (x) and outputs a string which
> contains x zeroes. e.g.
>
> foo(3) = "000"
> foo(5) = "00000"
>
> etc.
>
> in Python this function is ''.zfill(5)
> another possibility would be 5*'0'
>
> Equivalents in Ruby? I would be mainly interested in a zfill equivalent
> since that is faster that join or 5* imho.

>> "0" * 7
=> "0000000"

Kind regards

robert

-- 
Have a look: http://www.flickr.com/photos/fussel-foto/