is String a Valid BigDecimal - Android java.lang

Android examples for java.lang:String Parse

Description

is String a Valid BigDecimal

Demo Code


//package com.java2s;
import android.text.TextUtils;
import java.math.BigDecimal;

public class Main {
    public static boolean isValidBigDecimal(String value) {
        if (TextUtils.isEmpty(value)) {
            return false;
        }//from ww  w  . ja v a 2  s  .c  om

        try {
            BigDecimal money = new BigDecimal(value);
        } catch (Exception e) {
            return false;
        }

        return true;
    }
}

Related Tutorials