PeachDrawing.Text

PeachDrawing.Text.Unicode.Segmenter

Segmenter.FindWordBoundaries(ReadOnlySpan<char>) Method

Finds the boundaries between words, as a search or a double click would treat them: runs of letters and numbers, with the punctuation inside them, are one word, a run of spaces is one piece, and every other character is a piece of its own.

public static int[] FindWordBoundaries(System.ReadOnlySpan<char> text);

Parameters

text System.ReadOnlySpan<System.Char>

The text to segment.

Returns

System.Int32[]
The boundaries, as UTF-16 indices.