elixir-lang/elixir — pull request #2968 by alehander42 (2014-12-27 19:46:05+00:00)
Title: Implement Integer.parse/2

**Motivation**

`Elixir` has `Integer.to_string/1` and `Integer.to_string/2`.

`Integer.to_string/2` converts an integer to its text representation in a custom base.
`Integer.to_string/` does that for base 10.

The closest thing to an inverse function of `Integer.to_string` is `Integer.parse`. However there is only one version of it: `Integer.parse/1` which works only for base 10, which is odd.

This PR adds a `Integer.parse/2` function which can handle custom bases. `Integer.parse/1` just calls `Integer.parse/2` with base 10.

(`Integer.parse/2` accepts only bases in 2..36 and raises an ArgumentError when an invalid base is given. That way it's consistent with the behavior of `Integer.string/2`)