Golang Emoji parser, converter to html and images
parser := NewEmojiParser()
var text = "a #π© #and #π¦ #π³"
var i = -1
replased := parser.ReplaceAllStringFunc(text, func(s string) string {
i++
return strconv.Itoa(i)
})
// replased == "a #0 #and #1 #2"
parser := NewEmojiParser()
var text = "a #π© #and #π¦ #π³"
var i = -1
replased := parser.ToHtmlEntities(text, "%X)
// replased == "a #💩 #and #🍦 #😳"
for different type of fmt see: https://golang.org/pkg/fmt/
parser := NewEmojiParser()
var text = "a #π© #and #π¦ #π³"
var i = -1
replased := parser.ToHtmlImages(text)
result:
a #<img
class="emoji"
draggable="false"
alt="π©"
src="https://twemoji.maxcdn.com/36x36/1f4a9.png"> #and #<img
class="emoji"
draggable="false"
alt="π¦"
src="https://twemoji.maxcdn.com/36x36/1f366.png"> #<img
class="emoji"
draggable="false"
alt="π³"
src="https://twemoji.maxcdn.com/36x36/1f633.png">
- Instagram developers blog
- Twemoji SVG https://github.com/twitter/twemoji
- Unicode Emojii data emoji-data.txt
- Unicode Tech Report 51 tech report