Integer.parse

You're seeing just the function parse, go back to Integer module for more information.
Link to this function

parse(binary, base \\ 10)

View Source

Specs

parse(binary(), 2..36) :: {integer(), remainder_of_binary :: binary()} | :error

Parses a text representation of an integer.

An optional base to the corresponding integer can be provided. If base is not given, 10 will be used.

If successful, returns a tuple in the form of {integer, remainder_of_binary}. Otherwise :error.

Raises an error if base is less than 2 or more than 36.

If you want to convert a string-formatted integer directly to an integer, String.to_integer/1 or String.to_integer/2 can be used instead.

Examples

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

iex> Integer.parse("34.5")
{34, ".5"}

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

iex> Integer.parse("34", 10)
{34, ""}

iex> Integer.parse("f4", 16)
{244, ""}

iex> Integer.parse("Awww++", 36)
{509216, "++"}

iex> Integer.parse("fab", 10)
:error

iex> Integer.parse("a2", 38)
** (ArgumentError) invalid base 38