@Deleplace/

Check if string contains only digits

Ruby

No description

fork
loading
Files
  • main.rb
main.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
s = "123"
b = s.count("^0-9").zero?
puts b

s = "abc123def"
b = s.count("^0-9").zero?
puts b

s = "abc"
b = s.count("^0-9").zero?
puts b

s = "123.456"
b = s.count("^0-9").zero?
puts b
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]