From: Hal Fulton Date: 2006-08-19T10:26:27+09:00 Subject: Re: Bug in sprintf? Hal Fulton wrote: > Carlos wrote: > >> >> For that conversion, #to_i could have been used as well, and then '09' >> would >> be interpreted as decimal 9. Why should I expect my string to be passed >> through Integer() before formatting? That is not documented. >> > > Why would you pass a string to something that expects a number > anyway? Actually, let me say this, as it's more informative and constructive. If you need to convert your string to a number, it's best to do so explicitly. (If you really want to pass a string into sprintf, %s is the correct modifier.) Also note that while Integer() doesn't convert the way you want, to_i does: Integer("09") # error "09".to_i # 9 Cheers, Hal