reverseGraphemeClusters

Reverse the grapheme clusters (i.e., user-perceived characters) of a string.

Usage

var reverseGraphemeClusters = require( '@stdlib/string/base/reverse-grapheme-clusters' );

reverseGraphemeClusters( str )

Reverses the grapheme clusters (i.e., user-perceived characters) of a string.

var out = reverseGraphemeClusters( 'last man standing' );
// returns 'gnidnats nam tsal'

out = reverseGraphemeClusters( 'Hidden Treasures' );
// returns 'serusaerT neddiH'

out = reverseGraphemeClusters( 'foo bar' );
// returns 'rab oof'

Examples

var reverseGraphemeClusters = require( '@stdlib/string/base/reverse-grapheme-clusters' );

var str = reverseGraphemeClusters( 'presidential election' );
// returns 'noitcele laitnediserp'

str = reverseGraphemeClusters( 'JavaScript' );
// returns 'tpircSavaJ'

str = reverseGraphemeClusters( 'The Last of the Mohicans' );
// returns 'snacihoM eht fo tsaL ehT'

str = reverseGraphemeClusters( '๐Ÿถ๐Ÿฎ๐Ÿท๐Ÿฐ๐Ÿธ' );
// returns '๐Ÿธ๐Ÿฐ๐Ÿท๐Ÿฎ๐Ÿถ'
Did you find this page helpful?