/** * Converts a float followed by a unit name into an object. * * @param string a string of the form: <code>float " " unit</code> or null * @return the corresponding object or null * @exception NumberFormatException if the conversion failed */ public static NumberUnit<Float> toFloatUnit(String string) { if (string == null) { return null; } int firstSpace = findFirstSpace(string); String beforeSpace = beforeSpace(string, firstSpace); return new NumberUnit<Float>(new Float(beforeSpace), parseUnit(string, firstSpace)); }
/** * Converts a integer followed by a unit name into an object. * * @param string a string of the form: <code>integer " " unit</code> or null * @return the corresponding object or null * @exception NumberFormatException if the conversion failed */ public static NumberUnit<Integer> toIntUnit(String string) { if (string == null) { return null; } int firstSpace = findFirstSpace(string); String beforeSpace = beforeSpace(string, firstSpace); return new NumberUnit<Integer>(new Integer(beforeSpace), parseUnit(string, firstSpace)); }
/** * Converts a integer followed by a unit name into an object. * * @param string a string of the form: <code>integer " " unit</code> or null * @return the corresponding object or null * @exception NumberFormatException if the conversion failed */ public static NumberUnit<Integer> toIntUnit(String string) { if (string == null) { return null; } int firstSpace = findFirstSpace(string); String beforeSpace = beforeSpace(string, firstSpace); return new NumberUnit<Integer>(new Integer(beforeSpace), parseUnit(string, firstSpace)); }
/** * Converts a float followed by a unit name into an object. * * @param string a string of the form: <code>float " " unit</code> or null * @return the corresponding object or null * @exception NumberFormatException if the conversion failed */ public static NumberUnit<Float> toFloatUnit(String string) { if (string == null) { return null; } int firstSpace = findFirstSpace(string); String beforeSpace = beforeSpace(string, firstSpace); return new NumberUnit<Float>(new Float(beforeSpace), parseUnit(string, firstSpace)); }