segmentText()
Split segmented text into render-ready pieces.
Import
Section titled “Import”import { segmentText } from "@graphrefly/ts/solutions/reactive-layout";Signature
Section titled “Signature”function segmentText( text: string, segmentAdapter: SegmentAdapter,): { readonly texts: string[]; readonly isWordLike: boolean[]; readonly kinds: SegmentBreakKind[];}[]Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
text | string | Input text. |
segmentAdapter | SegmentAdapter | Segment adapter used to split words and graphemes. |
Returns
Section titled “Returns”Segment pieces with text, word-like, and break-kind arrays.
Example
Section titled “Example”segmentText("Hello world", getDefaultSegmentAdapter());Source
Section titled “Source”packages/ts/src/solutions/reactive-layout/segment.ts