BinaryFormat.List
Returns a binary format that reads a sequence of items and returns a list.
function (binaryFormat
as function, optionalcountOrCondition
as nullable any) as function
Returns a binary format that reads a sequence of items and returns a
list
. The binaryFormat
parameter specifies the binary format of each item. There are three ways to determine the number of items read: Binary Formats.Reading lists
Read bytes until the end of the data.
let
binaryData = #binary({1, 2, 3}),
listFormat = BinaryFormat.List(BinaryFormat.Byte)
in
listFormat(binaryData)
{1, 2, 3}
Read two bytes.
let
binaryData = #binary({1, 2, 3}),
listFormat = BinaryFormat.List(BinaryFormat.Byte, 2)
in
listFormat(binaryData)
{1, 2}
Read bytes until the byte value is greater than or equal to two.
let
binaryData = #binary({1, 2, 3}),
listFormat = BinaryFormat.List(BinaryFormat.Byte, (x) => x < 2)
in
listFormat(binaryData)
{1, 2}
Last modified 4yr ago