check is the string is s number in ruby code example
Example: ruby check if string is integer
class String
def numeric?
Float(self) != nil rescue false
end
end
"Hello World!".numeric?
class String
def numeric?
Float(self) != nil rescue false
end
end
"Hello World!".numeric?