diff options
author | rsiddharth <s@ricketyspace.net> | 2020-12-20 20:59:56 -0500 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-12-20 20:59:56 -0500 |
commit | e71a8f1750c2cc0fd6cbdb7048ddf5ff5ed95a7b (patch) | |
tree | 91715ea8ec5d2082069b5bcf55359cda64d93524 /lib/str.go | |
parent | d928e1126e6c5e8f45cc020249c3652d999f7569 (diff) |
lib/str: add NumToStr
Diffstat (limited to 'lib/str.go')
-rw-r--r-- | lib/str.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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 +} + |