Logo

Programming-Idioms

History of Idiom 137 > diff from v35 to v36

Edit summary for version 36 by nopeslide:
[Erlang] left side match must be tuple

Version 35

2019-09-29, 12:10:13

Version 36

2019-09-29, 12:10:54

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
_,Rest = string:to_integer(S),
B = Rest == "".
Code
{_,Rest} = string:to_integer(S),
B = Rest == "".
Doc URL
http://erlang.org/doc/man/string.html#to_integer-1
Doc URL
http://erlang.org/doc/man/string.html#to_integer-1