Get the number of grapheme clusters (user-perceived characters) in input, unlike string.length which counts UTF-16 code units.
input
string.length
graphemeLength('hello'); // 5graphemeLength('๐จโ๐ฉโ๐งโ๐ฆ'); // 1'๐จโ๐ฉโ๐งโ๐ฆ'.length; // 11 Copy
graphemeLength('hello'); // 5graphemeLength('๐จโ๐ฉโ๐งโ๐ฆ'); // 1'๐จโ๐ฉโ๐งโ๐ฆ'.length; // 11
Get the number of grapheme clusters (user-perceived characters) in
input, unlikestring.lengthwhich counts UTF-16 code units.