Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@YamiOdymel
Last active May 4, 2021 00:44
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save YamiOdymel/6f3aa12a945fa8b2f8c3b1682fff3d6c to your computer and use it in GitHub Desktop.
Save YamiOdymel/6f3aa12a945fa8b2f8c3b1682fff3d6c 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)
}
}
}
@YamiOdymel
Copy link
Author

Output

screen shot 2017-01-22 at 12 34 43 pm

@nexus166
Copy link

nexus166 commented Nov 5, 2019

the best :) thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment