base36

Base36 encoder/decoder.


License
MIT

Documentation

Base36 VersionBuild StatusLicense

Base36 encoder/decoder in Elixir. Based on custom base.

Usage

Encode

iex> Base36.encode(13)
"D"

iex> Base36.encode(31)
"V"

iex> Base36.encode(274)
"7M"

Decode!

iex> Base36.decode!("95")
329

iex> Base36.decode!("TETRAPYRROLE")
3871237878461204546

iex> Base36.decode!("ΠšΠΈΡ€ΠΈΠ»Π»ΠΈΡ†Π°")
** (ArgumentError) non-alphabet digit found: Π°
    (base36) lib/base36.ex:2: Base36.decode_char/1
    (base36) lib/base36.ex:2: Base36.decode/2

Decode

iex> Base36.decode("42")
{:ok, 146}

iex> Base36.decode("ERLANG")
{:ok, 892869676}

iex> Base36.decode("lower")
:error

License

Released under the MIT License.