Module hex

Authors: Serge Aleynikov (saleyn@gmail.com).

Description

Hexadecimal conversion functions

Function Index

dehex/1Convert a hex digit in range [$0..$9,$a..$f,$A..$F] to integer.
hex/1Convert an integer to a hex digit in range [0..15].
to_bin/1Convert a hex string to binary.
to_hex/1Convert an iolist to a hex string.
to_int/1Convert a hex string/binary to integer.

Function Details

dehex/1

dehex(C :: char()) -> integer()

Convert a hex digit in range [$0..$9,$a..$f,$A..$F] to integer.

hex/1

hex(C :: integer()) -> char()

Convert an integer to a hex digit in range [0..15].

to_bin/1

to_bin(Bin :: string()) -> binary()

Convert a hex string to binary.

to_hex/1

to_hex(I :: integer() | iolist()) -> binary()

Convert an iolist to a hex string.

to_int/1

to_int(S :: string() | binary()) -> integer()

Convert a hex string/binary to integer.