Java BigDecimal Parse string2BigDecimal(String valor)

Here you can find the source of string2BigDecimal(String valor)

Description

string Big Decimal

License

Open Source License

Declaration

public static BigDecimal string2BigDecimal(String valor) throws ParseException 

Method Source Code

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

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.ParseException;

import java.util.Locale;

public class Main {
    public static BigDecimal string2BigDecimal(String valor) throws ParseException {

        BigDecimal valorBig = BigDecimal.ZERO;
        Locale brasil = new Locale("pt", "BR");
        DecimalFormat df = new DecimalFormat("#,##0.00", new DecimalFormatSymbols(brasil));
        df.setParseBigDecimal(true);//w  ww  .  j  a v a2 s. com

        valorBig = (BigDecimal) df.parse(valor);

        return valorBig;

    }
}

Related

  1. parseBigDecimal(String number, BigDecimal defValue)
  2. parseBigDecimalForEntity(String bigDecimalString)
  3. parseTo_BigDecimal(String s)
  4. parseTo_BigDecimal(String s)
  5. parseToBigDecimal(Object value)
  6. stringToBigDecimal(String numeroStr)
  7. strToFloat(String text, int decimals)
  8. toDecimalString(String str, int decimal)