Ad
  • Custom User Avatar

    all right, quite interesting, thank you !

  • Custom User Avatar

    Wrote an explanation above ๐Ÿ˜Š

  • Custom User Avatar

    Oh, I should explain a bit. This version handles emojis and especially ZWJ sequences of emojis correctly.

    For example, this family emoji ๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ง is in fact there four emojis joined ๐Ÿ‘จ๐Ÿ‘จ๐Ÿ‘ง๐Ÿ‘ง. And each emoji is two bytes.

    [...'๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ง'].length
    // -> 7
    '๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ง'.length
    // -> 11
    '๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ง' === '\uD83D\uDC68\u200D\uD83D\uDC68\u200D\uD83D\uDC67\u200D\uD83D\uDC67'
    // -> true
    
  • Custom User Avatar

    I don't really understand

  • Custom User Avatar

    I didn't get it at first but that multibyte character handling is really neat. thanks