emoji-talk/signal-ex/main.go

39 lines
546 B
Go
Raw Normal View History

package main
import (
"fmt"
"io/ioutil"
"os"
"strings"
"github.com/emojisum/emojisum/emoji"
)
func main() {
buf, err := ioutil.ReadFile("num")
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(2)
}
str := strings.Replace(string(buf), " ", "", -1)
i := 0
for {
if i >= len(str) {
break
}
if strings.Contains(str[i:i+1], "\n") {
i += 1
fmt.Print("\n")
continue
}
d, err := emoji.FromHexString(str[i : i+2])
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(2)
}
i += 2
fmt.Print(d)
}
}