Class NumberUtils

java.lang.Object
net.lenni0451.imnbt.utils.NumberUtils

public class NumberUtils extends Object
  • Constructor Details

    • NumberUtils

      public NumberUtils()
  • Method Details

    • asByte

      @Nullable public static Byte asByte(String s)
      Try to parse a string to a byte.
      Parameters:
      s - The string to parse
      Returns:
      The parsed byte or null if the string is not a byte
    • asShort

      @Nullable public static Short asShort(String s)
      Try to parse a string to a short.
      Parameters:
      s - The string to parse
      Returns:
      The parsed short or null if the string is not a short
    • asInt

      @Nullable public static Integer asInt(String s)
      Try to parse a string to an integer.
      Parameters:
      s - The string to parse
      Returns:
      The parsed integer or null if the string is not an integer
    • asLong

      @Nullable public static Long asLong(String s)
      Try to parse a string to a long.
      Parameters:
      s - The string to parse
      Returns:
      The parsed long or null if the string is not a long
    • asFloat

      @Nullable public static Float asFloat(String s)
      Try to parse a string to a float.
      Parameters:
      s - The string to parse
      Returns:
      The parsed float or null if the string is not a float
    • asDouble

      @Nullable public static Double asDouble(String s)
      Try to parse a string to a double.
      Parameters:
      s - The string to parse
      Returns:
      The parsed double or null if the string is not a double