Answers for "ruby check if number"

0

ruby test is number

12.is_a? Numeric
Posted by: Guest on August-30-2020
-1

ruby check if string is integer

class String
  def numeric?
    Float(self) != nil rescue false
  end
end
"Hello World!".numeric?
Posted by: Guest on June-16-2020

Browse Popular Code Answers by Language