Here you can find the source of toFloat(String property, float f)
Parameter | Description |
---|---|
property | a parameter |
f | a parameter |
public static float toFloat(String property, float f)
//package com.java2s; //License from project: Apache License public class Main { /**/*from ww w . j a v a 2s . c o m*/ * tries to parse the given String into a float value * if this fails the default value is returned * @param property * @param f * @return */ public static float toFloat(String property, float f) { try { return Float.parseFloat(property); } catch (NumberFormatException ex) { return f; } } }