Hi friends
I want to check the value is numeric or not
For example
when i am checking numeric or not am expecting as below results
"34" => true
34 => true
"34sdfds" => it should return false
34.90 => false
am using ruby 1.8.7. can anyone suggest isthere is anymethod exist to
check these
Hi friends
I want to check the value is numeric or not
For example
when i am checking numeric or not am expecting as below results
"34" => true
34 => true
"34sdfds" => it should return false
34.90 => false
am using ruby 1.8.7. can anyone suggest isthere is anymethod exist to
check these
--
Sincerely yours,
Aleksey V. Zapparov A.K.A. ixti
FSF Member #7118
Mobile Phone: +34 677 990 688
Homepage: http://www.ixti.net
JID: zapparov@jabber.ru
Not quite. The question was about checking a value that could be a string, integer, float or presumably anything, and return true if the value contains digits only, false otherwise. At least that's how I interpret the message starting this thread.
···
On 07/13/2012 11:08 AM, Robert Klemme wrote:
On Fri, Jul 13, 2012 at 10:19 AM, Lars Haugseth > <ruby-talk@larshaugseth.com> wrote:
If o is allowed to be a Fixnum, you need to cast to string first:
/\A\d+\z/ === o.to_s
WTF? (That's the first time I remember me writing this here.)
Let me get that straight: you want to convert something which you
*know* is an integer to a String to check whether it is an integer?
seems the original post is not very clear,
the subject line implies only strings, the post itself does not.
···
Am 13.07.2012 11:41, schrieb Lars Haugseth:
On 07/13/2012 11:08 AM, Robert Klemme wrote:
Not quite. The question was about checking a value that could be a
string, integer, float or presumably anything, and return true if the
value contains digits only, false otherwise. At least that's how I
interpret the message starting this thread.