7,896,354.1   要变为  7896354.1,怎么办?

解决方案 »

  1.   

    7,896,354.1 
    这是 Double 类型的格式么?
    应该是转成字符串了吧
      

  2.   

    double  的格式就是这样的 7,896,354.1
    我不想要这样的,要这样的 7896354.1 
      

  3.   

    用DecimalFormat呀
        public static void main(String[] args) {
            Double d = 7896354.1;
            DecimalFormat df = new DecimalFormat("####.######");
            String s = df.format(d);
            System.out.println(s);
        }
      

  4.   

    这个值 是经过格式化
    转成了这个格式
    返回是的一个字符串
    你可以直接读没格式化之前的double值
      

  5.   

    package test;import java.text.DecimalFormat;
    public class TestDouble { /**
     * @param args
     */
      private final static DecimalFormat nf = new DecimalFormat("###,##0.00");
        public static String formatToMoney(String s) {
            if (s == null || s.equals("")) {
                return "0.00";
            }
            try {
                return formatToMoney(Double.parseDouble(s));
            } catch (Exception e) {
                return s;
            }
        }     public static String formatToMoney(double d) {
            try {
                return nf.format(d);
            } catch (Exception e) {
                return String.valueOf(d);
            }
        }
        public static void main(String[] args){
            String dd=TestDouble.formatToMoney("12345678990.78987");
            System.out.println(dd);    }
    }
      

  6.   


    "7,896,354.1".replace(",","");