DecimalFormat and Double.valueOf()

后端 未结 10 1249
鱼传尺愫
鱼传尺愫 2020-12-24 15:22

I\'m trying to get rid of unnecessary symbols after decimal seperator of my double value. I\'m doing it this way:

DecimalFormat format = new DecimalFormat(\"         


        
10条回答
  •  失恋的感觉
    2020-12-24 15:59

    looks like your local use a comma "," as a decimal separation.To get the "." as a decimal separator, you will have to declare:

    DecimalFormat dFormat =new DecimalFormat("#.#", new DecimalFormatSymbols(Locale.ENGLISH));
    

提交回复
热议问题