From: Lars Haugseth Date: 2012-07-13T18:41:56+09:00 Subject: Re: how to check string is numeric or not On 07/13/2012 11:08 AM, Robert Klemme wrote: > On Fri, Jul 13, 2012 at 10:19 AM, Lars Haugseth > 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? 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. -- Lars Haugseth