containers v0.3.2 Containers.Int

Provides functions for interacting with the Integer primitive using containers.

Summary

Functions

Wraps the Elxir Integer.parse function and returns Result container

Functions

parse(binary, base \\ 10)
parse(String.t, integer) :: Containers.Result.t

Wraps the Elxir Integer.parse function and returns Result container.

Examples

iex> Containers.Int.parse "34"
%Containers.Result{value: {:ok, {34, ""}}}

iex> Containers.Int.parse "34.5"
%Containers.Result{value: {:ok, {34, ".5"}}}

iex> Containers.Int.parse "three"
%Containers.Result{value: {:error, :no_parse}}

iex> Containers.Int.parse "a2", 38
%Containers.Result{value: {:error, "invalid base 38"}}