emoji
provides standardized ways for translating unicode code points for
Emoji to/from their emoji cheat sheet encoding, and is
most useful when working with third-party APIs such as Slack, GitHub, etc.
emoji
was written because other emoji packages for Go only provided cheat
sheet names to unicode conversion and not the inverse. Additionally, there were
no comprehensive emoticon packages available at the time.
Data for this package is generated from GitHub's gemoji project:
$ cd $GOPATH/src/github.com/kenshaw/emoji
$ go generate
Install in the usual Go fashion:
$ go get -u github.com/kenshaw/emoji
emoji
can be used similarly to the following:
// _example/example.go
package main
import (
"log"
"github.com/kenshaw/emoji"
)
func main() {
a := emoji.FromEmoticon(":-)")
log.Printf(":-) %+v", a)
b := emoji.FromAlias("slightly_smiling_face")
log.Printf(":-) %+v", b)
s := emoji.ReplaceEmoticonsWithAliases(":-) :D >:(")
log.Printf("s: %s", s)
n := emoji.ReplaceEmoticonsWithCodes(":-) :D >:(")
log.Printf("n: %s", n)
}
Please see the GoDoc listing for the complete API listing.
- Convert
UnicodeVersion
andIOSVersion
fields ofEmoji
type to something more easily comparable (ie, int)