From: Thomas Link Date: 2003-12-11T00:22:02+09:00 Subject: Re: ruby 1.8.0: Error on "%02d" % "08" or "%02d" % "09" >>`%': invalid value for Integer: "08" (ArgumentError) > > > irb(main):003:0> "%02d" % 08 > SyntaxError: compile error > (irb):3: Illegal octal digit > from (irb):3 > > Leading zeros have a special meaning with integer values. Your example is different as the second argument is not a string -- although I understand what you're hinting at. Anyway, converting the string into an integer in advance (as proposed by the previous poster) actually solved the problem. I nevertheless think it's inconsistent that string#to_i didn't expect an octal number too when string#% does so. Cheers, Thomas.