From: Rimantas Liubertas Date: 2006-11-18T02:27:00+09:00 Subject: Re: ruby equivalent PHP function is_numeric? > > After reading completely my Ruby book, I cannot find a function > > equivalent to the PHP is_numeric? to test a String > > > > myString.is_numeric? (check only digits and dot character) => > > return true or false <...> > def is_numeric?(s) > return (s.to_s =~ /^\d+(\.\d+|\d*)$/)?true:false > end <...> >> is_numeric?("1000_000") => false In ruby it is not only about dot and digits, but also underscores. Regards, Rimantas -- http://rimantas.com/