Here you can find the source of convertFloatValue(String data)
Parameter | Description |
---|---|
data | String data |
public static float convertFloatValue(String data)
//package com.java2s; /*/*from w ww. java2 s . c om*/ * Copyright (c) 2014 eSOL Co.,Ltd. and Nagoya University * * This software is released under the MIT License. * http://opensource.org/licenses/mit-license.php */ public class Main { /** * Conversion to Float from String. * -1.0f is returned if can not convert. * @param data String data * @return Float value */ public static float convertFloatValue(String data) { float ret = -1.0f; if (data != null) { try { ret = Float.valueOf(data); } catch (NumberFormatException e) { ret = -1.0f; } } return ret; } }