Here you can find the source of toFloat(String str)
public static float toFloat(String str)
//package com.java2s; /**//w ww. j a v a 2 s.c o m * Copyright (c) Nulla Development Group, 2014-2015 * ??????????Nulla??????????? * Developed by Kanbe-Kotori. * ??????? Kanbe-Kotori?????? * This project is open-source, and it is distributed under * the terms of GNU General Public License. You can modify * and distribute freely as long as you follow the license. * ???????????????????????GNU???????????? * ???????????????????????????????????? * http://www.gnu.org/licenses/gpl.html */ public class Main { public static float toFloat(String str) { if (isNumeric(str)) return Float.valueOf(str); return 0; } public static boolean isNumeric(String str) { try { Float.valueOf(str); } catch (Exception e) { return false; } return true; } }