From: Tim Hunter Date: 2007-06-21T07:34:53+09:00 Subject: Re: Code Critique: check if int or float ole __ wrote: > Hello again folks, > > I'm really starting to like this language. I'm working towards building > a simple expression evaluator. I couldn't seem to find any methods for > testing whether a string contains an integer or float. In PHP (where I'm > from) you've got your is_numeric(). Is there such a method in Ruby? > The Integer() method raises an exception if its argument isn't an integer: Integer("1") is okay. Integer("1.0") raises ArgumentError. Similarly Float() raises an exception if its argument isn't a Float: Float("1.0") is okay. Float("1") is okay. Float("x") raises ArgumentError. -- RMagick OS X Installer [http://rubyforge.org/projects/rmagick/] RMagick Hints & Tips [http://rubyforge.org/forum/forum.php?forum_id=1618] RMagick Installation FAQ [http://rmagick.rubyforge.org/install-faq.html]