From: Floyd Wright Date: 2006-08-30T01:27:03+09:00 Subject: Re: Testing a string's value is a positive integer irb(main):005:0> 1.5.integer? => false William Crawford wrote: > 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. >