替换表情 [英] Replace Emoticons

查看:63
本文介绍了替换表情的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能用表情符号代替一个单词吗?

Is it possible to replace a word with emoticons?

例如

NSString * myString = @我为他感到难过"

NSString *myString = @"I am sad of him"

现在,我想检查该单词是否包含悲伤"一词,如果有的话,我想用悲伤的表情符号替换该单词.

now i want to check the word whether it contains the word "sad", if it has i want to replace that word with sad emoticons.

我不确定nsstring中的表情符号

I am not sure how to have emoticons in the nsstring

请让我知道

推荐答案

是的,您可以使用以下方法做到这一点:

yeah, you can do this using this:

myString = [NSString stringByReplacingOccurrencesOfString:@"sad" withString:@"\ue058"];

检查此链接以获取表情符号代码:(尽管将& #x替换为\ u) http://barrow.io/posts/iphone-emoji/

Check this link for emoji codes: (replace the &#x with \u though) http://barrow.io/posts/iphone-emoji/

这篇关于替换表情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆