Example usage for java.lang Double parseDouble

List of usage examples for java.lang Double parseDouble

Introduction

In this page you can find the example usage for java.lang Double parseDouble.

Prototype

public static double parseDouble(String s) throws NumberFormatException 

Source Link

Document

Returns a new double initialized to the value represented by the specified String , as performed by the valueOf method of class Double .

Usage

From source file:Main.java

public static int roundedAQI(String aqi) {
    return (int) Math.round(Double.parseDouble(aqi));
}

From source file:Main.java

public static Integer stringToInteger(String s) {
    final Double d = Double.parseDouble(s);
    return d.intValue();
}

From source file:Main.java

public static boolean isNumeric(String s) {
    try {//  ww  w  .j a  v a2s.co m
        Double.parseDouble(s);
    } catch (NumberFormatException nfe) {
        return false;
    }
    return true;
}

From source file:Main.java

public static double toDouble(String s) {
    try {//  w w  w  . j a va2 s  . co  m
        return Double.parseDouble(s);
    } catch (Exception e) {
        // TODO: handle exception
    }
    return 0;
}

From source file:Main.java

public static double progressToDouble(String doubleToParse) {
    double num1 = Double.parseDouble(doubleToParse.split("/")[0]);
    double num2 = Double.parseDouble(doubleToParse.split("/")[1]);
    return (num1 / num2);
}

From source file:Main.java

public static boolean isDouble(String value) {
    try {//from w ww . j  ava  2 s  . c om
        Double.parseDouble(value);
        if (value.contains("."))
            return true;
        return false;
    } catch (NumberFormatException e) {
        return false;
    }
}

From source file:Main.java

public static Double getValue(String howMuch) {
    return isEmpty(howMuch) ? 0 : Double.parseDouble(howMuch);
}

From source file:Main.java

public static double moneyToDouble(String value) {
    try {//from  ww  w .j  ava 2  s.  c  om
        return Double.parseDouble(value.replaceAll("\\.", "").replaceAll(",", ".").replace("R$", ""));
    } catch (Exception e) {
        return 0;
    }
}

From source file:Main.java

public static boolean isNumeric(String str) {
    try {/*from  w  ww .j  a  v a2s . c om*/
        Double d = Double.parseDouble(str);
    } catch (NumberFormatException nfe) {
        return false;
    }
    return true;
}

From source file:Main.java

public static boolean isDouble(String doubleNumber) {
    try {//from w ww.j  a  v a2  s.com
        Double.parseDouble(doubleNumber);
        return true;
    } catch (Exception e) {
        return false;
    }

}