is a string a double Number - Android java.lang

Android examples for java.lang:Double

Description

is a string a double Number

Demo Code

import android.location.Location;
import java.math.BigDecimal;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DecimalFormat;
import java.text.NumberFormat;

public class Main{

    @SuppressWarnings("unused")
    public static boolean isNumber(String str) {

        try {// w  w w.  j a  va  2s.co  m
            double d = Double.parseDouble(str);
        } catch (NumberFormatException nfe) {
            return false;//str.matches("[0-9]{5}-?[0-9]{3}?");
        }
        return true;

    }

}

Related Tutorials