Logo

Programming-Idioms

History of Idiom 137 > diff from v11 to v12

Edit summary for version 12 by steenslag:
New Ruby implementation by user [steenslag]

Version 11

2016-08-13, 22:02:02

Version 12

2016-09-09, 21:36:39

Idiom #137 Check if string contains only digits

Set boolean b to true if string s contains only characters in range '0'..'9', false otherwise.

Idiom #137 Check if string contains only digits

Set boolean b to true if string s contains only characters in range '0'..'9', false otherwise.

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