Logo

Programming-Idioms

History of Idiom 137 > diff from v37 to v38

Edit summary for version 38 by areille:
New Dart implementation by user [areille]

Version 37

2019-09-30, 19:38:53

Version 38

2020-02-09, 16:39:02

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
final b = RegExp(r'^[0-9]+$').hasMatch(s);