fix the always-on thousands comma

This commit is contained in:
Simon Michael 2008-10-15 19:54:35 +00:00
parent ea2a418811
commit 5f1bec0b60

View File

@ -48,12 +48,13 @@ instance Show Amount where show = showAmount
-- | Get the string representation of an amount, based on its commodity's
-- display settings.
showAmount :: Amount -> String
showAmount (Amount (Commodity {symbol=sym,side=side,spaced=spaced,precision=p}) q)
showAmount (Amount (Commodity {symbol=sym,side=side,spaced=spaced,comma=comma,precision=p}) q)
| side==L = printf "%s%s%s" sym space quantity
| side==R = printf "%s%s%s" quantity space sym
where
space = if spaced then " " else ""
quantity = punctuatethousands $ printf ("%."++show p++"f") q
quantity = commad $ printf ("%."++show p++"f") q
commad = if comma then punctuatethousands else id
-- | Add thousands-separating commas to a decimal number string
punctuatethousands :: String -> String