From: Peter Szinek Date: 2006-11-13T06:43:41+09:00 Subject: Re: sprintf bug (?) Bernard Kenik wrote: > > ----- Original Message ----- From: "Peter Szinek" > To: "ruby-talk ML" > Sent: Saturday, November 11, 2006 1:28 PM > Subject: sprintf bug (?) > > >> Hello all, >> >> I am wondering if I have just found a bug in (s)printf... >> >> According to the PickAxe, table "sprintf flag characters": >> >> ================= snip ================================== >> >> 0 (zero) all Pad with zeros, not spaces. >> >> ================= snip ================================== >> >> so I think this call >> >> irb(main):053:0> sprintf("%05s", 123) >> => " 123" >> >> should correctly result in >> >> "00123" >> > sprintf("%05d",123) # 'd' not 's' > => "00123" :) I know 'd' is not 's', it was a bad example. It should have been irb(main):002:0> sprintf("%10s",'hello') => " hello" (there are no zeroes...) Peter __ http://www.rubyrailways.com