diff options
author | rsiddharth <s@ricketyspace.net> | 2020-12-20 20:59:24 -0500 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-12-20 20:59:24 -0500 |
commit | d928e1126e6c5e8f45cc020249c3652d999f7569 (patch) | |
tree | 0b531a1ad32f62871b314c8d43565bc847d52cec | |
parent | 2467d8f6f73b412db636d21b7acf8100324ee027 (diff) |
lib/str: add NumToChar
-rw-r--r-- | lib/str.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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 +} + |