@stdlib/string-split-grapheme-clusters
v0.2.2
Published
Split a string by its grapheme cluster breaks.
Downloads
277
Readme
splitGraphemeClusters
Split a string by its grapheme cluster breaks.
Installation
npm install @stdlib/string-split-grapheme-clusters
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 []
Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2024. The Stdlib Authors.