util - amend units in PrettyByteSize
This commit is contained in:
parent
09118b9073
commit
81ed472723
|
@ -51,13 +51,13 @@ func CastStrings2ints(strs *[]string) []int {
|
|||
|
||||
func PrettyByteSize(b int64) string {
|
||||
bf := float64(b)
|
||||
for _, unit := range []string{"", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi"} {
|
||||
for _, unit := range []string{"", "Kio", "Mio", "Gio", "Tio", "Pio", "Eio", "Zio"} {
|
||||
if math.Abs(bf) < 1024.0 {
|
||||
return fmt.Sprintf("%3.2f%s", bf, unit)
|
||||
}
|
||||
bf /= 1024.0
|
||||
}
|
||||
return fmt.Sprintf("%.2fYi", bf)
|
||||
return fmt.Sprintf("%.2fYio", bf)
|
||||
}
|
||||
|
||||
func Ucfirst(str *string) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user