summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/str.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/str.go b/lib/str.go
index 0191806..3c768ff 100644
--- a/lib/str.go
+++ b/lib/str.go
@@ -82,3 +82,11 @@ func isAlphaPunch(c byte) bool {
}
return false
}
+
+func NumToChar(n int64) byte {
+ if 0 <= n && n <= 9 {
+ return byte(48 + n)
+ }
+ return 0
+}
+