|
|
@@ -9,3 +9,18 @@ var WxEmojiMap = make(map[string]string)
|
|
|
func init() {
|
|
|
json.Unmarshal([]byte(wxEmojiStr), &WxEmojiMap)
|
|
|
}
|
|
|
+
|
|
|
+func EmojiConvert(str string) string {
|
|
|
+ arr := []rune(str)
|
|
|
+
|
|
|
+ text := ""
|
|
|
+ for _, _v := range arr {
|
|
|
+ v := string(_v)
|
|
|
+ if _, ok := WxEmojiMap[v]; ok {
|
|
|
+ text = text + WxEmojiMap[v]
|
|
|
+ } else {
|
|
|
+ text = text + v
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return text
|
|
|
+}
|