Java Float Number Create toFloat(String s)

Here you can find the source of toFloat(String s)

Description

to Float

License

Open Source License

Declaration

public static float toFloat(String s) 

Method Source Code

//package com.java2s;
/*/*from   w  w w.  j a  va  2s. com*/
 * Copyright (C) ${year} Omry Yadan <${email}>
 * All rights reserved.
 *
 * See https://github.com/omry/banana/blob/master/BSD-LICENSE for licensing information
 */

public class Main {
    public static float toFloat(String s) {
        return toFloat(s, -1);
    }

    public static float toFloat(String s, float def) {
        return (s == null || s.length() == 0 || s.equals("null")) ? def : Float.parseFloat(s);
    }
}

Related

  1. toFloat(short[] src)
  2. toFloat(String parameter)
  3. toFloat(String property, float f)
  4. toFloat(String s)
  5. toFloat(String s)
  6. toFloat(String str)
  7. toFloat(String str)
  8. toFloat(String str)
  9. toFloat(String str, float defaultValue)