summaryrefslogtreecommitdiffstats
path: root/lib/str.go
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2020-12-20 20:59:56 -0500
committerrsiddharth <s@ricketyspace.net>2020-12-20 20:59:56 -0500
commite71a8f1750c2cc0fd6cbdb7048ddf5ff5ed95a7b (patch)
tree91715ea8ec5d2082069b5bcf55359cda64d93524 /lib/str.go
parentd928e1126e6c5e8f45cc020249c3652d999f7569 (diff)
lib/str: add NumToStr
Diffstat (limited to 'lib/str.go')
-rw-r--r--lib/str.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/str.go b/lib/str.go
index 3c768ff..6938bfd 100644
--- a/lib/str.go
+++ b/lib/str.go
@@ -90,3 +90,12 @@ func NumToChar(n int64) byte {
return 0
}
+func NumToStr(n int64) string {
+ s := ""
+ for n != 0 {
+ s = string(NumToChar(n%10)) + s
+ n /= 10
+ }
+ return s
+}
+