I need to parse an ascii with multiple tokens. The tokens can be seen as keys. After every token there is a bunch of lines belonging to that token, the values.
The order of tokens is unknown.

I would like to read the file in as a whole string, and split the string with:
splitter(fileString, [token1, token2, ... tokenN]);

And would like to get a range of strings each starting with tokenX and ending before the next token.

Does something like this exist?

I know how to parse the string line by line and create new strings and append the appropriate lines, but I don't know how to do this with a lazy result range and new allocations.

Reply via email to