moved zero pad

This commit is contained in:
Hazel Noack
2025-10-09 13:03:51 +02:00
parent fe244c7e68
commit 07468e5b4f
3 changed files with 26 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
package common
import (
"strconv"
"strings"
)
@@ -12,3 +13,11 @@ func Unify(s string) string {
}
return s
}
func ZeroPad(num int, length int) string {
str := strconv.Itoa(num)
if len(str) >= length {
return str
}
return strings.Repeat("0", length-len(str)) + str
}