1
0
Fork 0

Add codePointToGlyph to convert codepoint into string

This commit is contained in:
Daniele Tricoli 2015-09-22 14:25:19 +02:00
parent 5e6f0abfd6
commit fd442a3a2b
1 changed files with 13 additions and 0 deletions

View File

@ -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
}