Java tutorial
//package com.java2s; public class Main { private static float getFloatFromString(String s) { if (s != null && !s.trim().equals("")) { s = s.replaceAll(",", ""); try { if (s.endsWith("%")) { return Float.valueOf(s.substring(0, s.length() - 1)); } else { return Float.valueOf(s); } } catch (NumberFormatException e) { } } return 0; } }