List of utility methods to do Float Number Parse
double | readFloatFromString(String inStr) Read float data from a string DecimalFormat dformat = new DecimalFormat("#"); DecimalFormatSymbols dfs = new DecimalFormatSymbols(); dfs.setDecimalSeparator('.'); dformat.setDecimalFormatSymbols(dfs); String trimStr = inStr.trim(); if (trimStr.startsWith("+")) { trimStr = trimStr.substring(1); ParsePosition pp = new ParsePosition(0); Number num = dformat.parse(trimStr, pp); if (null == num) { throw new Exception("Invalid Float In TLE"); return num.doubleValue(); |
Float | string2float(String arg, Locale loc) stringfloat if (arg == null) { return null; NumberFormat nf = NumberFormat.getInstance(loc); return nf.parse(arg).floatValue(); |
Object | tryParseFloat(String floatValue) try Parse Float Object parsedValue; try { parsedValue = Float.parseFloat(floatValue); } catch (NumberFormatException nfe) { parsedValue = floatValue; return parsedValue; |
Float | tryParseFloat(String value) Try to parse the string as float or return null if failed try { return Float.parseFloat(value); } catch (NumberFormatException e) { return null; |
boolean | tryParseFloat(String value) Returns whether or not the String can be parsed as an Float try { Float.parseFloat(value); } catch (NumberFormatException ex) { return false; return true; |
float[] | tryParseFloats(String[] in) Tries to parse an array of floats. try { return parseFloats(in); } catch (NumberFormatException e) { return new float[0]; |