Java String to Float atof(final String str, final float def)

Here you can find the source of atof(final String str, final float def)

Description

atof

License

Open Source License

Declaration

public static float atof(final String str, final float def) 

Method Source Code

//package com.java2s;

public class Main {
    public static float atof(final String str, final float def) {
        try {/*from   ww  w  . ja  v a  2s .  c o  m*/
            return Float.parseFloat(str);
        } catch (final Exception ex) {
            ex.printStackTrace();
        }
        return def;
    }
}

Related

  1. asFloat(final String str, final float def)
  2. asFloat(String string)
  3. asFloat(String v)
  4. asFloat(String value)