Android String to Float Convert TryParse(String str, float defaultFloat)

Here you can find the source of TryParse(String str, float defaultFloat)

Description

Try Parse

Declaration

public static float TryParse(String str, float defaultFloat) 

Method Source Code

//package com.java2s;

public class Main {
    public static float TryParse(String str, float defaultFloat) {
        try {/*from   w w w. j  a v a  2s  . c  o  m*/
            float f = Float.parseFloat(str);
            return f;
        } catch (NumberFormatException ex) {
            return defaultFloat;
        }
    }
}

Related

  1. String2AmountFloat(String str)
  2. isFloat(String str)
  3. isFloat(String str, int precision)
  4. getFloatValue(double val, int len)
  5. parseFloat(String string, float defValue)
  6. parseFloat(String value)