first-word ( str -- i )
Word and grapheme breaks
Prev:string-reverse ( str -- rts )
Next:first-word-from ( start str -- i )


Vocabulary
unicode.breaks

Inputs and outputs
stra string
iindex


Word description
Finds the index of the end of the first word in the string.

Definition
USING: kernel sequences unicode.breaks.private ;

IN: unicode.breaks

: first-word ( str -- i )
[ [ length ] [ first word-break-prop ] bi ] keep 1 swap dup
[ word-break-next ] curry find-index-from drop nip swap or
;