2

salePrice次のような値を持つことができる文字列があり、小数点以下2桁の29.90000,91.01000ように出力を取得したいと考えています。29.90,91.01私は文字列を使用しています。

4

6 に答える 6

1

Apache Commons Mathematics Libraryを使用できます

    NumberFormat nf = NumberFormat.getInstance();
    nf.setMinimumFractionDigits(2);
    nf.setMaximumFractionDigits(2);
    ComplexFormat cf = new ComplexFormat(nf);
    Complex complex = cf.parse("29.90000");
于 2013-06-07T13:21:43.217 に答える