From: Adrian Fraiha Date: 2006-07-23T13:55:54+09:00 Subject: Re: Function for integers to displayed with same number of d Michael W. Ryder wrote: > Adrian Fraiha wrote: >> Is there or a function, or anyone know of a hack without using if else >> statements extensivley to have numbers displayed, such as 1 as 0001, 100 >> as 0100, 1000 as 1000 etc? >> >> Anyhelp is appreciated, thanks! >> > > irb(main):001:0> "%04d" % 1 > => "0001" Hey, thanks to both of you for your help. I had no idea Modulus acted like that. -- Posted via http://www.ruby-forum.com/.