0

当我使用以下格式化程序时,我得到了错误的值。

<mx:CurrencyFormatter
        id="currencyFormatter"
        currencySymbol=""
        precision="2"
        rounding="up"
        decimalSeparatorFrom=","
        decimalSeparatorTo=","
        useNegativeSign="true"
        useThousandsSeparator="true"
        thousandsSeparatorFrom="."
        thousandsSeparatorTo="."
        alignSymbol="left" />

例如,如果我传递值 1.5,我将得到“15,00”作为格式方法的结果。有谁知道这里发生了什么?Tks

4

1 回答 1

0

我发现了问题:在我的代码中,我试图这样做:

currencyFormatter.format(item.total.toString())

我解决了删除 toString 方法,如下所示:

currencyFormatter.format(item.total)

如果我将值“1.5”作为字符串传递给格式化程序,我会得到“15,00”作为结果。但是如果我将值“1.5”作为数字传递,我会得到正确的格式(“1,50”)。

于 2012-10-04T03:38:30.277 回答