Logo

Programming-Idioms

History of Idiom 137 > diff from v10 to v11

Edit summary for version 11 by BBaz:
New D implementation by user [BBaz]

Version 10

2016-08-13, 21:11:32

Version 11

2016-08-13, 22:02: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.

Imports
import std.ascii;
import std.algorithm;
Code
bool b = s.all!isDigit;