Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert your documents to emoji
package main
import (
"fmt"
"strings"
"github.com/cespare/argf"
)
var alphamoji = map[rune]string{
'a': "🅰",
'b': "🅱️",
'c': "©",
'd': "🇩",
'e': "📧",
'f': "🎏",
'g': "⛽",
'h': "♓",
'i': "ℹ",
'j': "🗾",
'k': "🎋",
'l': "👢",
'm': "Ⓜ",
'n': "♑",
'o': "⭕",
'p': "🅿",
'q': "🇶",
'r': "Ⓡ",
's': "⚡",
't': "🌴",
'u': "⛎",
'v': "♈",
'w': "🇼",
'x': "❌",
'y': "✌",
'z': "🇿",
}
func main() {
for argf.Scan() {
line := argf.String()
line = strings.ToLower(line)
for _, c := range line {
if emoji, ok := alphamoji[c]; ok {
fmt.Print(emoji)
} else {
fmt.Printf("%c", c)
}
}
fmt.Println()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment