Ben Gribaudo wrote: > Hello, > > I am puzzled by some strange (to me) behavior exhibited by String's % > method as well as sprintf. Both "%02d" % "07" and sprintf("%02d","07") > output "07". However, "%02d" % "08" and sprintf("%02d","08") both raise > 'ArgumentError: invalid value for Integer: "08"'. Why does a string of > "07" work while "08" does not? Because leading 0 makes your argument string be interpreted as an octal number, where '8' is not a valid digit (0..7 are valid in base 8). Hope it helps. Gennady.