Class NumberUtils

java.lang.Object
org.yuemi.libs.api.util.NumberUtils

public final class NumberUtils extends Object
  • Method Details

    • parseSuffix

      public static double parseSuffix(@NotNull @NotNull String input)
      Parses a string containing a number with optional suffix (e.g. 1k, 1.9k, 1m) into a double.
      Parameters:
      input - the input string
      Returns:
      the parsed double value
      Throws:
      IllegalArgumentException - if the format is invalid
    • formatSuffix

      @NotNull public static @NotNull String formatSuffix(double value)
      Formats a double into a string with a suffix (e.g. 1.9k, 1m).
      Parameters:
      value - the double value
      Returns:
      the formatted string
    • format

      @NotNull public static @NotNull String format(double value, @NotNull @NotNull FormatType type)
      Formats a double into a string depending on the FormatType.
      Parameters:
      value - the value to format
      type - the format type (FORMATTED or RAW)
      Returns:
      the formatted string