Method: String#is_numeric?
- Defined in:
- lib/origen/core_ext/string.rb
#is_numeric? ⇒ Boolean Also known as: numeric?
Check if a String is a numeric
94 95 96 97 |
# File 'lib/origen/core_ext/string.rb', line 94 def is_numeric? return true if self =~ /\A\d+\Z/ true if Float(self) rescue false # rubocop:disable Style/RescueModifier end |