Created
October 11, 2018 20:42
-
-
Save mtimkovich/b79bf2f694c5243a11d8eb37ad65fb4c to your computer and use it in GitHub Desktop.
Convert your documents to emoji
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" | |
"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