emoji icon indicating copy to clipboard operation
emoji copied to clipboard

How could I convert emoji string to emoji icons and vice versa?

Open sujit-baniya opened this issue 4 years ago • 1 comments

How could I convert emoji string to emoji icons and vice versa? For e.g.

msg := "😀 😃 😄 😁 😆 😅 😂 🤣 \U0001F972 😊 😇 :plus:"

I wanted to convert \U0001F972 and :plus: to emojis Also I could convert emojis to \U0001F972 or :plus: format

I could convert :plus: to Emoji and Unicode strings like \U0001F972 OR I could convert \U0001F972 to :some string: and Emoji OR I could convert Emoji to :plus: or \U0001F972

sujit-baniya avatar Dec 31 '20 19:12 sujit-baniya

Here is a way to convert a string of emoji to sample.

package main

import (
	"github.com/kyokomi/emoji/v2"
)

func main() {
	msg := "😀 😃 😄 😁 😆 😅 😂 🤣 \U0001F972 😊 😇 :plus:"
	emoji.Println(msg)
}

image

Currently, we have a map for reverse lookup, but we do not provide an interface for reverse conversion. https://github.com/kyokomi/emoji/blob/master/emoji.go#L25-L28

kyokomi avatar Jan 01 '21 01:01 kyokomi