public class ParseString extends Object
Modifier and Type | Method and Description |
---|---|
static Float |
string2percent(String str,
String format,
int decimalPlaces)
Converts an String into a rounded percent value.
It tries to parse the String as percent value first. |
public static Float string2percent(String str, String format, int decimalPlaces) throws ParseException, IllegalArgumentException
str
- String to convertformat
- format string for probability WITHOUT TRAILING "%"decimalPlaces
- number of decimal places to round toParseException
- if it was not possible to convert the String into a Float.IllegalArgumentException
- if decimalPlaces < 0for the class DecimalFormat in the Java API
Copyright © 2013. All Rights Reserved.