Here you can find the source of toFloat(final String value)
Parameter | Description |
---|---|
value | the value |
public static float toFloat(final String value)
//package com.java2s; //License from project: Apache License public class Main { /**/*w w w .ja v a 2 s . c o m*/ * To float. * * @param value the value * @return the float */ public static float toFloat(final String value) { if (value == null) { return 0.0F; } String szTemp = ""; for (int i = 0; i < value.length(); i++) if (value.charAt(i) != ',') { szTemp = szTemp + value.charAt(i); } try { final float f = Float.parseFloat(szTemp); return f; } catch (final NumberFormatException e) { final float f1 = 0.0F; return f1; } } }