structured_io v0.1.0 StructuredIO.Scanner View Source
Provides functions for decomposing structured data, such as markup or binary-encoded data.
Link to this section Summary
Functions
Reads from the specified scan_data
beginning with the specified from_data
and ending with the specified through_data
Link to this section Types
The data matched in a scan.
The data remaining after the match/0
in a scan.
Link to this section Functions
Reads from the specified scan_data
beginning with the specified from_data
and ending with the specified through_data
.
If scan_data
does not both begin with from_data
and contain
through_data
, the result is nil
.
Examples
iex> StructuredIO.Scanner.scan_across "<elem>foo</elem",
...> "<elem>",
...> "</elem>"
nil
iex> StructuredIO.Scanner.scan_across "<elem>foo</elem><elem>bar</elem>",
...> "<elem>",
...> "</elem>"
{"<elem>foo</elem>",
"<elem>bar</elem>"}
iex> StructuredIO.Scanner.scan_across <<0, 0, 0, 1, 2, 3, 255, 255>>,
...> <<0, 0, 0>>,
...> <<255, 255, 255>>
nil
iex> StructuredIO.Scanner.scan_across <<0, 0, 0, 1, 2, 3, 255, 255, 255, 0, 0, 0, 4, 5, 6, 255, 255, 255>>,
...> <<0, 0, 0>>,
...> <<255, 255, 255>>
{<<0, 0, 0, 1, 2, 3, 255, 255, 255>>,
<<0, 0, 0, 4, 5, 6, 255, 255, 255>>}