Standard built-ins
Intl.Segmenter()
Creates a locale-aware segmenter for grapheme, word or sentence segmentation. Results depend on implementation locale and Unicode data.
Formal Syntax & Structure
javascript syntaxjavascript
new Intl.Segmenter([locales], [options])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| locales | String | Array | Requested locale tags. |
| options | Object | Granularity and locale options. |
Return Value
Intl.Segmenter
Segmenter instance.
Working Example
Example Snippetjavascript
console.log([...new Intl.Segmenter("en",{granularity:"grapheme"}).segment("é")].length);