Next: buffer_truncate
Prev: buffer_retrieve
buffer_to_strings(buffer, [separator])This function returns a list of strings constructed from buffer by splitting it around the bytes given by the buffer separator. If separator is not specified,
buffer_to_strings() uses the
buffer %[10], a single-byte buffer containing the ASCII code for
a newline. buffer_to_strings() treats the bytes in buffer
not accounted for by the separator as ASCII values; unprintable ASCII
values are stripped. The last element of the returned list is a buffer
containing the bytes in the buffer after the last separator found; no
string is included in the returned list for these bytes.
Examples:
buffer_to_strings(%[65, 66, 67, 13, 10, 67, 66, 65, 13, 10, 66])
=> ["ABC", "CBA", %[66]]
buffer_to_strings(%[66, 10, 10, 65, 10])
=> ["B", "", "A", %[]]
buffer_to_strings(%[65, 66, 67, 13, 10, 67, 66, 65, 10, 66], %[66])
=> ["A", "CC", "A", %[]]