moved zero pad
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user