Using end

Remember our vowels example from The bitset! datatype section?

;-- see Chapter08/more-features.red:vowel: charset "aeiou" str: "dog"find str vowel   ;== "og"

Using parse we can write this as follows:

parse str [ to vowel to end]    ;== trueparse "xyz" [ to vowel to end]  ;== false

The end word, which exists only in the parse dialect, returns true when the current position pointer is at the end of the input.

Get Learn Red - Fundamentals of Red now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.