util - amend units in PrettyByteSize

This commit is contained in:
Mahdi Abu Yasmine 2023-11-20 00:15:38 +01:00
parent 09118b9073
commit 81ed472723

View File

@ -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) {