Class NumberHelper
java.lang.Object
com.pixelmonmod.pixelmon.api.util.helpers.NumberHelper
Static helper class for generic number operations
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Patternstatic final DecimalFormatstatic final Patternstatic final Pattern -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatPercentage(double d) static OptionalDoubleparseDouble(String arg) Parses the arg to a doublestatic OptionalIntParses the arg to an integerstatic OptionalLongParses the arg to a longstatic NumberAttempts 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
-