iOS
#define EMOJI_CODE_TO_SYMBOL(x) ((((0x808080F0 | (x & 0x3F000) >> 4) | (x & 0xFC0) << 10) | (x & 0x1C0000) << 18) | (x & 0x3F) << 24);
//获取默认表情编码
- (void)defaultEmoticons {
NSMutableArray * emojiArray = [NSMutableArray new];
for (int i=0x1F600; i<=0x1F64F; i++) {
//if (i < 0x1F641 || i > 0x1F644) {
int sym = EMOJI_CODE_TO_SYMBOL(i);
DLog(@"sym--%d",sym);
NSString *emoT = [[NSString alloc] initWithBytes:&sym length:sizeof(sym) encoding:NSUTF8StringEncoding];
DLog(@"emoT---%@",emoT);
[emojiArray addObject:emoT];
//}
}
//return array;
}
Android
private void getEmojiList() {
for (int i = 0x1F600; i <= 0x1F64F; i++) {
String stringByUnicode = getEmojiStringByUnicode(i);
listUnicEmoji.add(stringByUnicode);
}
}
private String getEmojiStringByUnicode(int unicode) {
return new String(Character.toChars(unicode));
}
网友评论