From: Jeremy Lizt Date: 2006-08-25T07:20:18+09:00 Subject: Re: Alternative to String#to_i ? Thanks to everyone for the quick response. The Integer suggestion works great, but I'll point out one wrinkle that I encountered: Integer nil # => 0 That was a small surprise. (These zeros keep popping up when you may not expect them!) My little conversion method now works fine and looks like this: def string_to_i(str) if str.nil? then return nil else Integer str end rescue nil end