Java Float Number Parse tryParseFloat(String value)

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

Description

Try to parse the string as float or return null if failed

License

Open Source License

Parameter

Parameter Description
value a parameter

Declaration

public static Float tryParseFloat(String value) 

Method Source Code

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

public class Main {
    /**//from   w w  w.  java  2  s .  com
     * Try to parse the string as float or return null if failed
     * 
     * @param value
     * @return
     */
    public static Float tryParseFloat(String value) {
        try {
            return Float.parseFloat(value);
        } catch (NumberFormatException e) {
            return null;
        }
    }
}

Related

  1. readFloatFromString(String inStr)
  2. string2float(String arg, Locale loc)
  3. tryParseFloat(String floatValue)
  4. tryParseFloat(String value)
  5. tryParseFloats(String[] in)