Java Parse Decimal parseDecimal(String d)

Here you can find the source of parseDecimal(String d)

Description

parse Decimal

License

Apache License

Declaration

public static Double parseDecimal(String d) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.DecimalFormat;

public class Main {
    private static final DecimalFormat decimalFormat = new DecimalFormat(
            "#,###.00");

    public static Double parseDecimal(String d) {
        try {/*from w w  w. j  a v  a2s  . c o m*/
            return decimalFormat.parse(d).doubleValue();
        } catch (Exception e) {
            return 0D;
        }
    }
}

Related

  1. parseBigDecimal(String s, NumberFormat format)
  2. parseDecimal(PushbackReader reader)
  3. parseDecimal(String text)