From: Robert Klemme Date: 2006-05-29T19:11:22+09:00 Subject: Re: Equivalent of Python zfill? 2006/5/29, Peter Szinek : > 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/