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