Class NumberHelper
java.lang.Object
com.pixelmonmod.pixelmon.api.util.helpers.NumberHelper
Static helper class for generic number operations
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Pattern
static final DecimalFormat
static final Pattern
static final Pattern
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
formatPercentage
(double d) static OptionalDouble
parseDouble
(String arg) Parses the arg to a doublestatic OptionalInt
Parses the arg to an integerstatic OptionalLong
Parses the arg to a longstatic Number
Attempts to parse the given string to a number
-
Field Details
-
FORMATTER
-
INT_PATTERN
-
LONG_PATTERN
-
DOUBLE_PATTERN
-
-
Constructor Details
-
NumberHelper
public NumberHelper()
-
-
Method Details
-
parseInt
Parses the arg to an integer- Parameters:
arg
- The arg to parse- Returns:
- The potential parsed integer
-
parseLong
Parses the arg to a long- Parameters:
arg
- The arg to parse- Returns:
- The potential parsed long
-
parseDouble
Parses the arg to a double- Parameters:
arg
- The arg to parse- Returns:
- The potential parsed double
-
parseNumber
Attempts to parse the given string to a number- Parameters:
s
- The string to parse- Returns:
- The parsed number
-
formatPercentage
-