fork download
  1. class String
  2. def isalpha?
  3. !!match(/^[[:alpha:]]+$/)
  4. end
  5. def isdigit?
  6. !!match(/^\d+$/)
  7. end
  8. end
  9.  
  10. print 'f'.isalpha?, ' ', '1'.isalpha?, "\n"
  11. print 'f'.isdigit?, ' ', '1'.isdigit?
Success #stdin #stdout 0.01s 7412KB
stdin
Standard input is empty
stdout
true false
false true