@webdeveric/utils
    Preparing search index...

    Function graphemeLength

    • Get the number of grapheme clusters (user-perceived characters) in input, unlike string.length which counts UTF-16 code units.

      Parameters

      • input: string

      Returns number

      graphemeLength('hello'); // 5
      graphemeLength('๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ'); // 1
      '๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ'.length; // 11