Last active
May 4, 2021 00:44
-
-
Save YamiOdymel/6f3aa12a945fa8b2f8c3b1682fff3d6c to your computer and use it in GitHub Desktop.
Print the emoji with Golang. https://play.golang.org/p/yPgKw3Z9HW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// (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
Output