Java Double Number Format formatDouble(String value)

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

Description

Checks if the value can safely be converted to a double primitive.

License

Open Source License

Parameter

Parameter Description
value The value validation is being performed on.

Return

format result

Declaration

public static Double formatDouble(String value) 

Method Source Code

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

public class Main {
    /**/*  ww  w.  ja  v a  2  s  .  c o  m*/
     * Checks if the value can safely be converted to a double primitive.
     *
     * @param value The value validation is being performed on.
     * @return format result
     */
    public static Double formatDouble(String value) {
        if (value == null) {
            return null;
        }

        try {
            return new Double(value);
        } catch (NumberFormatException e) {
            return null;
        }

    }
}

Related

  1. formatDouble(double value)
  2. formatDouble(double value)
  3. formatDouble(double value, int decimals)
  4. formatDouble(final double value)
  5. formatDouble(final Object value)
  6. formatDoubleAsString(double num, int n)
  7. formatDoubleFast(double source, int decimals, int precision, StringBuffer target)
  8. formatDoubleForDecimalPlaces(double d, int decimalcount)
  9. formatDoubleInfinity(Double d)