signal example

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2018-10-23 12:26:48 +01:00
parent 94c9d40eee
commit ffa7c3c4b8
Signed by: vbatts
GPG key ID: 10937E57733F1362
4 changed files with 41 additions and 0 deletions

38
signal-ex/main.go Normal file
View file

@ -0,0 +1,38 @@
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)
}
}

3
signal-ex/num Normal file
View file

@ -0,0 +1,3 @@
1589431412 8991911005
5208747685 9704261801
9636252115 2237458346

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB