Over a million developers have joined DZone.

Determine If A Syntactically Correct Series Of Characters Is Numeric (in A Way Cool Way Returning True Or False) In Ruby


Re: ruby equivalent PHP function is_numeric?
Posted by David Vallner (Guest) on 18.11.2006 02:27  
ara.t.howard@noaa.gov wrote:
>> thanks
>> joss
>   harp:~ > cat a.rb
>   def is_numeric?(n) Float n rescue false end

def is_numeric?(n) begin Float n; return true rescue false end

Predicate methods not returning a boolean make my skin crawl even if
it's all the same difference for conditionals.

David Vallner

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}