summaryrefslogtreecommitdiffstats
path: root/lib/str.go
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2020-12-20 20:59:24 -0500
committerrsiddharth <s@ricketyspace.net>2020-12-20 20:59:24 -0500
commitd928e1126e6c5e8f45cc020249c3652d999f7569 (patch)
tree0b531a1ad32f62871b314c8d43565bc847d52cec /lib/str.go
parent2467d8f6f73b412db636d21b7acf8100324ee027 (diff)
lib/str: add NumToChar
Diffstat (limited to 'lib/str.go')
-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
+}
+