From: James Edward Gray II Date: 2006-08-25T06:18:55+09:00 Subject: Re: Alternative to String#to_i ? On Aug 24, 2006, at 4:10 PM, Jeremy Lizt wrote: > Is there an alternative method to String#to_i that will return nil > instead of zero for invalid numerical strings? Try this: >> Integer("junk") ArgumentError: invalid value for Integer: "junk" from (irb):2:in `Integer' from (irb):2 from :0 >> Integer("junk") rescue nil => nil Hope that helps. James Edward Gray II