I can write a function
&[u8] -> Vec<&[u8]>
that splits on the b'.'
u8 value. For ecample,
b"foo.bar.cat.dog.x.y.z" -> vec![b"foo", b"bar", b"cat", b"dog", b"x, b"y", b"z"]
(sort of, not exactly, as in practice the &[u8] would be a slice of the original, whereas the above is probably generating new &[u8].
Question: is there an idiomatic way to do this via builtins (rather than creating a mut vec
, keeping track of indicies, and running a for loop) ?