String.to_integer

You're seeing just the function to_integer, go back to String module for more information.

Specs

to_integer(t()) :: integer()

Returns an integer whose text representation is string.

string must be the string representation of an integer. Otherwise, an ArgumentError will be raised. If you want to parse a string that may contain an ill-formatted integer, use Integer.parse/1.

Inlined by the compiler.

Examples

iex> String.to_integer("123")
123

Passing a string that does not represent an integer leads to an error:

String.to_integer("invalid data")
** (ArgumentError) argument error
Link to this function

to_integer(string, base)

View Source

Specs

to_integer(t(), 2..36) :: integer()

Returns an integer whose text representation is string in base base.

Inlined by the compiler.

Examples

iex> String.to_integer("3FF", 16)
1023