lastGraphemeCluster
Return the last
n
grapheme clusters (i.e., user-perceived characters) of a string.
Usage
var lastGraphemeCluster = require( '@stdlib/string/base/last-grapheme-cluster' );
lastGraphemeCluster( str, n )
Returns the last n
grapheme clusters (i.e., user-perceived characters) of a string.
var out = lastGraphemeCluster( 'Hello World', 1 );
// returns 'd'
out = lastGraphemeCluster( 'Evening', 3 );
// returns 'ing'
out = lastGraphemeCluster( 'foo bar', 10 );
// returns 'foo bar'
Examples
var lastGraphemeCluster = require( '@stdlib/string/base/last-grapheme-cluster' );
var str = lastGraphemeCluster( 'Hello World!', 1 );
// returns '!'
str = lastGraphemeCluster( 'JavaScript', 6 );
// returns 'Script'
str = lastGraphemeCluster( 'stdlib', 10 );
// returns 'stdlib'
str = lastGraphemeCluster( '🐶🐮🐷🐰🐸', 2 );
// returns '🐰🐸'
str = lastGraphemeCluster( '六书/六書', 2 );
// returns '六書'