Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sujit-baniya opened this issue Dec 31, 2020 · 1 comment
Open

Comments

@sujit-baniya
Copy link

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

@kyokomi
Copy link
Owner

kyokomi commented Jan 1, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants