ios - Some emojis has a length of 3? (digits) -
i trying implement way of counting number of emojis in nsstring . have found way works emojis, struggling emojis, seems defined in different way others. for example hot beverage icon has unicode hex of u+2615 (codepoint 9749), zero digit has unicode hex of u+0030 u+20e3 (codepoint 3154147). i using nsstring category determine number of emojis: @implementation nsstring (emojis) - (bool)isemoji { const unichar high = [self characteratindex: 0]; // surrogate pair (u+1d000-1f77f) if (0xd800 <= high && high <= 0xdbff) { const unichar low = [self characteratindex: 1]; const int codepoint = ((high - 0xd800) * 0x400) + (low - 0xdc00) + 0x10000; return (0x1d000 <= codepoint && codepoint <= 0x1f77f); } else // not surrogate pair (u+2100-27bf) { return (0x2100 <= high && high <= 0x27bf); } } - (nsuinteger)numbersofemojis { nsuinteger __block emojicount = 0; [self en...