From: William Crawford Date: 2006-08-30T01:19:55+09:00 Subject: Re: Testing a string's value is a positive integer Farrel Lifson wrote: > On 29/08/06, James Deuchar wrote: >> I feel certain I must be missing a trick here...am about to go down the >> -- >> Posted via http://www.ruby-forum.com/. >> >> > > Check if num.to_f - num.to_i == 0, if that's true you're dealing with > a integer otherwise a float. > > Farrel num.to_f == num.to_i Would also give true/false on whether or not it's an integer or not. -- Posted via http://www.ruby-forum.com/.