It is not about whitespace, really.

That function parses from left to right. If the string starts with an
integer in the given base, it returns it:

iex> Integer.parse("1")
{1, ""}

If *some* integer has been extracted and some character is invalid, the
*rest* of the string is returned together with the integer so far parsed:

iex> Integer.parse("1a")
{1, "a"}

The first example is an edge case, if no such invalid character is found,
the string is exhausted and you get an empty string.

Finally, if no integer is found at the start, :error is returned:

iex> Integer.parse("a")
:error

Whitespace is a particular case of this rule.

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAM%3DYcdgm2y1nU%3D8MTdNVjCUDjgfKfM%3DT0Vf2CRA4TPpH-Wct6Q%40mail.gmail.com.

Reply via email to