containers v0.7.1 Containers.Classy.Integer View Source
Provide total function support for Integer
in the
Elixir standard library.
Link to this section Summary
Functions
Wraps the Elxir Integer.parse
function and returns
Result
container
Link to this section Functions
Link to this function
parse(binary, base \\ 10)
View Source
parse(String.t, integer) :: Containers.Result.t
Wraps the Elxir Integer.parse
function and returns
Result
container.
Examples
iex> Containers.Classy.Integer.parse "34"
%Containers.Result{value: {:ok, {34, ""}}}
iex> Containers.Classy.Integer.parse "34.5"
%Containers.Result{value: {:ok, {34, ".5"}}}
iex> Containers.Classy.Integer.parse "three"
%Containers.Result{value: {:error, :no_parse}}
iex> Containers.Classy.Integer.parse "a2", 38
%Containers.Result{value: {:error, "invalid base 38"}}