graphemes

Splits the string into an array of extended grapheme clusters that approximate user-perceived characters.

In other words, this function splits a string into characters, preserving emoji and other complex characters.

Syntax

graphemes(string)

Parameters

Return value

An array of strings.

Examples

graphemes("Hello, こんにちは, 👩🏾‍🦰")
["H","e","l","l","o",","," ","こ","ん","に","ち","は",","," ","👩🏾‍🦰"]
graphemes("a👨‍👩‍👧‍👦b")
[ "a", "👨‍👩‍👧‍👦", "b" ]
// Compare to:
[..."a👨‍👩‍👧‍👦b"]
[ "a", "👨", "‍", "👩", "‍", "👧", "‍", "👦", "b" ]