1
0
Fork 0

Add codePointToGlyph to convert codepoint into string

main
Daniele Tricoli 7 years ago
parent 5e6f0abfd6
commit fd442a3a2b
  1. 13
      utils.go

@ -2,9 +2,11 @@ package main // import "eriol.xyz/piken"
import (
"encoding/csv"
"fmt"
"io"
"net/http"
"os"
"strconv"
"time"
"github.com/Sirupsen/logrus"
@ -84,3 +86,14 @@ func readCsvFile(filepath string) (records [][]string, err error) {
return records, nil
}
// Convert an unicode codepoint into a string.
func codePointToGlyph(codepoint string) (string, error) {
s, err := strconv.ParseInt(codepoint, 16, 32)
if err != nil {
return "", err
}
return fmt.Sprintf("%c", s), nil
}

Loading…
Cancel
Save