Package net.lenni0451.imnbt.utils
Class NumberUtils
java.lang.Object
net.lenni0451.imnbt.utils.NumberUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ByteTry to parse a string to a byte.static DoubleTry to parse a string to a double.static FloatTry to parse a string to a float.static IntegerTry to parse a string to an integer.static LongTry to parse a string to a long.static ShortTry to parse a string to a short.
-
Constructor Details
-
NumberUtils
public NumberUtils()
-
-
Method Details
-
asByte
Try to parse a string to a byte.- Parameters:
s- The string to parse- Returns:
- The parsed byte or
nullif the string is not a byte
-
asShort
Try to parse a string to a short.- Parameters:
s- The string to parse- Returns:
- The parsed short or
nullif the string is not a short
-
asInt
Try to parse a string to an integer.- Parameters:
s- The string to parse- Returns:
- The parsed integer or
nullif the string is not an integer
-
asLong
Try to parse a string to a long.- Parameters:
s- The string to parse- Returns:
- The parsed long or
nullif the string is not a long
-
asFloat
Try to parse a string to a float.- Parameters:
s- The string to parse- Returns:
- The parsed float or
nullif the string is not a float
-
asDouble
Try to parse a string to a double.- Parameters:
s- The string to parse- Returns:
- The parsed double or
nullif the string is not a double
-