Method: String#is_digit?
- Defined in:
- lib/thefox-ext/ext/string.rb
#is_digit? ⇒ Boolean
Is a String only made of numbers?
5 6 7 8 |
# File 'lib/thefox-ext/ext/string.rb', line 5 def is_digit? r = '0'..'9' self.split('').keep_if{ |c| r.include?(c) }.count == self.length end |