pluralize 1.1 kilobytes etc
This commit is contained in:
parent
dcf74cf8a4
commit
b8da297c77
1 changed files with 4 additions and 4 deletions
|
@ -118,7 +118,7 @@ roughSize units abbrev i
|
||||||
|
|
||||||
showUnit i' (Unit s a n) = let (num, decimal) = chop i' s in
|
showUnit i' (Unit s a n) = let (num, decimal) = chop i' s in
|
||||||
show num ++ decimal ++ " " ++
|
show num ++ decimal ++ " " ++
|
||||||
(if abbrev then a else plural num n)
|
(if abbrev then a else plural num decimal n)
|
||||||
|
|
||||||
chop :: Integer -> Integer -> (Integer, String)
|
chop :: Integer -> Integer -> (Integer, String)
|
||||||
chop i' d =
|
chop i' d =
|
||||||
|
@ -130,9 +130,9 @@ roughSize units abbrev i
|
||||||
then (num, "")
|
then (num, "")
|
||||||
else (num, "." ++ ds')
|
else (num, "." ++ ds')
|
||||||
|
|
||||||
plural n u
|
plural num decimal n
|
||||||
| n == 1 = u
|
| num == 1 && null decimal = n
|
||||||
| otherwise = u ++ "s"
|
| otherwise = n ++ "s"
|
||||||
|
|
||||||
{- displays comparison of two sizes -}
|
{- displays comparison of two sizes -}
|
||||||
compareSizes :: [Unit] -> Bool -> ByteSize -> ByteSize -> String
|
compareSizes :: [Unit] -> Bool -> ByteSize -> ByteSize -> String
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue