Java BigDecimal from toBigDecimal(String value)

Here you can find the source of toBigDecimal(String value)

Description

to Big Decimal

License

Open Source License

Declaration

public static BigDecimal toBigDecimal(String value) 

Method Source Code


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

import java.math.BigDecimal;

public class Main {
    public static BigDecimal toBigDecimal(String value) {
        if (isNumber(value)) {
            return new BigDecimal(value);
        }//  w  ww . j  av a  2 s  .  c  o  m
        return null;

    }

    public static boolean isNumber(String numStr) {
        try {
            if (numStr == null || numStr.trim().equals(""))
                return false;
            new BigDecimal(numStr);
            return true;
        } catch (NumberFormatException e) {
            return false;
        }
    }
}

Related

  1. toBigDecimal(String s)
  2. toBigDecimal(String s)
  3. toBigDecimal(String s, int scale)
  4. toBigDecimal(String str)
  5. toBigDecimal(String value)
  6. toBigDecimal(String value)
  7. toBigDecimal(String value)
  8. toBigDecimal(T value)
  9. toBigDecimal(Vector doubleVector)