Bunch v0.1.0 Bunch.Bitstring View Source
A bunch of helpers for manipulating bitstrings.
Link to this section Summary
Functions
Splits given bitstring into parts of given size
Splits given bitstring into parts of given size
Link to this section Functions
Link to this function
split(data, chunk_size)
View Source
split(bitstring(), pos_integer()) :: [bitstring()]
Splits given bitstring into parts of given size.
Remaining part is being cut off.
Examples
iex> <<1, 2, 3, 4, 5, 6>> |> Bunch.Bitstring.split(2)
[<<1, 2>>, <<3, 4>>, <<5, 6>>]
iex> <<1, 2, 3, 4, 5, 6, 7>> |> Bunch.Bitstring.split(2)
[<<1, 2>>, <<3, 4>>, <<5, 6>>]
Link to this function
split_rem(data, chunk_size)
View Source
split_rem(bitstring(), chunk_size :: pos_integer()) :: {[bitstring()], remainder :: bitstring()}
Splits given bitstring into parts of given size.
Returns list of chunks and remainder.
Examples
iex> <<1, 2, 3, 4, 5, 6>> |> Bunch.Bitstring.split_rem(2)
{[<<1, 2>>, <<3, 4>>, <<5, 6>>], <<>>}
iex> <<1, 2, 3, 4, 5, 6, 7>> |> Bunch.Bitstring.split_rem(2)
{[<<1, 2>>, <<3, 4>>, <<5, 6>>], <<7>>}