Thank you both, PositionableStream>>upToAll worked fine ! On Tue, Feb 9, 2016 at 11:01 AM, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Leonardo,
You could try PositionalStream>>#upToAll:
But watch out: if the substring does not occur, it will effectively read #upToEnd
HTH,
Sven
On 09 Feb 2016, at 13:29, Leonardo Silva <leonardo.humberto@gmail.com> wrote:
Hi,
I'd like to skip to a specific position in a stream based on a substring. I got the following example that works for a single character:
stream := 'abcdef' readStream. stream skipTo: $e. stream next. -â $f
But it does not work for substrings. I'd like to have something like:
stream := 'abcdef' readStream. stream skipTo: 'de'. stream next. -â "But this returns nil"
Do you know how to do it?
Thanks,
Leonardo