Java BigDecimal from String stringToBigDecimal(String numberString)

Here you can find the source of stringToBigDecimal(String numberString)

Description

string To Big Decimal

License

Open Source License

Declaration

public static BigDecimal stringToBigDecimal(String numberString) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.math.BigDecimal;

public class Main {
    public static BigDecimal stringToBigDecimal(String numberString) {
        BigDecimal BD;/*from w w  w  . jav a 2  s .c o m*/

        Double number = Double.parseDouble(numberString);
        if (number.doubleValue() == 0.0) {
            BD = BigDecimal.ZERO;
        } else {
            BD = new BigDecimal(number);
        }

        return BD;
    }
}

Related

  1. string2BigDecimal(String aValue)
  2. string2BigDecimal(String s)
  3. string2BigDecimal(String st)
  4. String2BigDecimal(String str)
  5. stringToBigDecimal(String src, int[] endPos)
  6. stringToDec(final CharSequence stringValue, final BigDecimal defaultValue)