time-to-botec/squiggle/node_modules/@stdlib/string/split-grapheme-clusters/README.md
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

2.9 KiB

splitGraphemeClusters

Split a string by its grapheme cluster breaks.

Usage

var splitGraphemeClusters = require( '@stdlib/string/split-grapheme-clusters' );

splitGraphemeClusters( str )

Splits a string by its grapheme cluster breaks.

var out = splitGraphemeClusters( 'café' );
// returns [ 'c', 'a', 'f', 'é' ]

out = splitGraphemeClusters( '🍕🍕🍕' );
// returns [ '🍕', '🍕', '🍕' ]

Examples

var splitGraphemeClusters = require( '@stdlib/string/split-grapheme-clusters' );

var out = splitGraphemeClusters( 'abc' );
// returns [ 'a', 'b', 'c' ]

out = splitGraphemeClusters( 'Iñtërnâtiônàlizætiøn' );
// returns [ 'I', 'ñ', 't', 'ë', 'r', 'n', 'â', 't', 'i', 'ô', 'n', 'à', 'l', 'i', 'z', 'æ', 't', 'i', 'ø', 'n' ]

out = splitGraphemeClusters( '\uD834\uDD1E' );
// returns [ '𝄞' ]

out = splitGraphemeClusters( '! !' );
// returns [ '!', ' ', '!' ]

out = splitGraphemeClusters( '' );
// returns []