ruby check if string is number 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?