From d928e1126e6c5e8f45cc020249c3652d999f7569 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sun, 20 Dec 2020 20:59:24 -0500 Subject: lib/str: add NumToChar --- lib/str.go | 8 ++++++++ 1 file changed, 8 insertions(+) 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 +} + -- cgit v1.2.3