Standard built-ins

Intl.Segmenter()

Try the free JavaScript compiler

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

NameTypeDescription
localesString | ArrayRequested locale tags.
optionsObjectGranularity and locale options.

Return Value

Intl.Segmenter

Segmenter instance.

Working Example

Example Snippetjavascript
console.log([...new Intl.Segmenter("en",{granularity:"grapheme"}).segment("é")].length);
JavaScript Reference