Forum: Ruby on Rails Re: beer

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A43dfa24838887d5ea9ac1f2820317c4?d=identicon&s=25 Sean Cribbs (Guest)
on 2006-03-29 21:22
(Received via mailing list)
to_f will convert it to a Float, .to_i to an Integer, but these won't
"tell" you whether it's numerical, in fact they often accept strings
that have some digits in them but also other characters.

The better solution might be to use a regular expression, the content of
which will be entirely dependent on what type of number you are
expecting.

Sean Cribbs
Web Services - KCKCC
>>> blerloko@hotmail.com 3/29/2006 12:41 PM >>>

Hello, all


I have one string in my controller but i need to knwon how i verify if
it is numerical


Thanks...
This topic is locked and can not be replied to.