Package org.yuemi.libs.api.util
Class NumberUtils
java.lang.Object
org.yuemi.libs.api.util.NumberUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull Stringformat(double value, @NotNull FormatType type) Formats a double into a string depending on the FormatType.static @NotNull StringformatSuffix(double value) Formats a double into a string with a suffix (e.g.static doubleparseSuffix(@NotNull String input) Parses a string containing a number with optional suffix (e.g.
-
Method Details
-
parseSuffix
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
Formats a double into a string with a suffix (e.g. 1.9k, 1m).- Parameters:
value- the double value- Returns:
- the formatted string
-
format
Formats a double into a string depending on the FormatType.- Parameters:
value- the value to formattype- the format type (FORMATTED or RAW)- Returns:
- the formatted string
-