DecimalFormat nf = new DecimalFormat ("###,###,###,###,##0.00") ;
现在要将53,135.98转换为53135.98?

解决方案 »

  1.   

    public static void main(String[] agrs)
    {
    DecimalFormat nf = new DecimalFormat ("###,###,###,###,##0.00") ; 
    System.out.println(nf.format(123456.123));
    double d = 0;
    try{
    String str=nf.format(123456.123);
    String newstr="";
    StringTokenizer st=new StringTokenizer (str,",");
    while(st.hasMoreElements())
    {
    newstr=newstr+st.nextToken();
    }
    d=Double.parseDouble(newstr);
    }catch(NumberFormatException e){System.out.println("nihuajie");}
    System.out.println(d);
    }
      

  2.   

    我查不到....
    只好用StringTokenizer了...
      

  3.   

    DecimalFormat nf = new DecimalFormat ("###,###,###,###,##0.00") ; 
    Number a = null;
        try
        {
            a = nf.parse("53,135.98");
        }
        catch (ParseException e)
        {
            e.printStackTrace();
        }
        double b=a.doubleValue();