Module binary

An implementation of a subset of the Erlang/OTP binary interface.

Function Index

at/2 Get a byte from a binary by index.
part/3Get the part of a given binary.
split/2Split a binary according to pattern.

Function Details

at/2


at(Binary::binary(), Index::non_neg_integer()) -> byte()

Binary: binary to get a byte from
Index: 0-based index of the byte to return

returns: value of the byte from the binary

Get a byte from a binary by index.

part/3


part(Binary::binary(), Pos::non_neg_integer(), Len::integer()) -> binary()

Binary: binary to extract a subbinary from
Pos: 0-based index of the subbinary to extract
Len: length, in bytes, of the subbinary to extract.

returns: a subbinary from Binary

Get the part of a given binary. A negative length can be passed to count bytes backwards.

split/2


split(Binary::binary(), Pattern::binary()) -> [binary()]

Binary: binary to split
Pattern: pattern to perform the split

returns: a list composed of one or two binaries

Split a binary according to pattern. If pattern is not found, returns a singleton list with the passed binary. Unlike Erlang/OTP, pattern must be a binary.