WordsToInteger v0.1.0 WordsToInteger View Source

Converts numbers spelled out as English words to integers.

Link to this section Summary

Functions

Converts a number spelled out as English words to an integer.

Link to this section Functions

Link to this function

convert(str)

View Source
convert(binary()) :: {:error, :invalid_input} | {:ok, integer()}

Converts a number spelled out as English words to an integer.

Examples

iex> WordsToInteger.convert("one hundred and sixty eight")
{:ok, 168}

iex> WordsToInteger.convert("invalid string")
{:error, :invalid_input}