The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.
When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.
Return the next extended grapheme cluster break in a string after a specified position.
npm install @stdlib/string-next-grapheme-cluster-break
var nextGraphemeClusterBreak = require( '@stdlib/string-next-grapheme-cluster-break' );
Returns the next extended grapheme cluster break in a string after a specified position.
var out = nextGraphemeClusterBreak( 'last man standing' ); // returns 1
By default, the function searches for a grapheme cluster break starting from the first index. To specify an alternative starting search index, provide a
var out = nextGraphemeClusterBreak( 'last man standing', 4 ); // returns 5
stringis an empty string, the function returns
- If an extended grapheme cluster break does not exist after
fromIndex, the function returns
- Note that
fromIndexdoes not refer to a visual character position, but to an index in the ordered sequence of UTF-16 code units.
var nextGraphemeClusterBreak = require( '@stdlib/string-next-grapheme-cluster-break' ); var out = nextGraphemeClusterBreak( 'last man standing', 4 ); // returns 5 out = nextGraphemeClusterBreak( 'presidential election', 8 ); // returns 9 out = nextGraphemeClusterBreak( 'अनुच्छेद', 1 ); // returns 3 out = nextGraphemeClusterBreak( '🌷', 0 ); // returns -1
Copyright © 2016-2023. The Stdlib Authors.