Skip to content

Instantly share code, notes, and snippets.

@gokusenz
Forked from YamiOdymel/emoji.go
Created November 1, 2017 09:12
Show Gist options
  • Save gokusenz/27963aca309fdf580eb744b66110b230 to your computer and use it in GitHub Desktop.
Save gokusenz/27963aca309fdf580eb744b66110b230 to your computer and use it in GitHub Desktop.
Print the emoji with Golang. https://play.golang.org/p/yPgKw3Z9HW
// (c) 2017 Yami Odymel
// This code is licensed under MIT license.
package main
import (
"fmt"
"html"
"strconv"
)
func main() {
// Hexadecimal ranges from: http://apps.timwhitlock.info/emoji/tables/unicode
emoji := [][]int{
// Emoticons icons.
{128513, 128591},
// Dingbats.
{9986, 10160},
// Transport and map symbols.
{128640, 128704},
}
for _, value := range emoji {
for x := value[0]; x < value[1]; x++ {
// Unescape the string (HTML Entity -> String).
str := html.UnescapeString("&#" + strconv.Itoa(x) + ";")
// Display the emoji.
fmt.Println(str)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment