From: James Edward Gray II Date: 2010-01-20T00:28:46+09:00 Subject: Re: string to int On Jan 19, 2010, at 4:13 AM, Phillip Curry wrote: > Is there a nice way to convert a string to an integer if it is in fact an integer, and to return nil or even an error if it's not? The method to_i returns 0 if the string is not an integer, which isn't hugely helpful, as I want to be able to distinguish between the integer 0 and non-integer strings. I see you already have your answer, but just in case it helps I've written a blog post about some handy conversion methods, like Integer(): http://blog.grayproductions.net/articles/conversion_methods James Edward Gray II