-
-
Save nexus166/8197feef990ac4eb6f7b0366b28ee5a9 to your computer and use it in GitHub Desktop.
golang codepage emojis
This file contains 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
package main | |
import ( | |
"fmt" | |
"html" | |
) | |
func main() { | |
// Hexadecimal ranges from: http://unicode.myseosolution.de/ | |
emoji := [][]int{ | |
// Playing cards :D | |
{128768, 128895}, | |
// Misc | |
{127744, 128511}, | |
// Emoticons icons | |
{128513, 128591}, | |
// Dingbats | |
{9986, 10160}, | |
// Transport and map symbols. | |
{128640, 128767}, | |
// Alchemical | |
//{128768, 128895}, | |
} | |
for _, value := range emoji { | |
for x := value[0]; x < value[1]; x++ { | |
i := intStr(x) | |
// Unescape the string (HTML Entity -> String). | |
if str := codepageToEmoji(i); str != "" { | |
// Display the emoji. | |
fmt.Println(i + ":\t" + str) | |
} | |
} | |
} | |
} | |
func intStr(i int) string { | |
return fmt.Sprintf("%d", i) | |
} | |
func codepageToEmoji(s string) string { | |
return html.UnescapeString("&#" + s + ";") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment