From: "Hal E. Fulton" Date: 2002-08-04T09:57:21+09:00 Subject: Re: String -> Integer anomoly? ----- Original Message ----- From: "Gavin Sinclair" To: "ruby-talk ML" Sent: Saturday, August 03, 2002 7:39 PM Subject: String -> Integer anomoly? > Why does "09".to_i return 9 > and Integer("09") raise an error? Arguably a feature. My understanding is that this was done on purpose. It sometimes gets me confused, though. I believe that Integer is "smarter" than String#to_i. This came up when we were discussing the fact that to_i doesn't raise exceptions. "abc".to_i # 0 It also doesn't know different bases. "09".to_i # 9 (assumes decimal with leading 0) "0xabc".to_i # 0 Someone else can elaborate more. Hal