From e71a8f1750c2cc0fd6cbdb7048ddf5ff5ed95a7b Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sun, 20 Dec 2020 20:59:56 -0500 Subject: lib/str: add NumToStr --- lib/str.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/str.go') 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 +} + -- cgit v1.2.3