NumberHelper extension

Extension methods on num for converting to human-readable formats.

on

Properties

asPercentageText String
Example:
no setter
asPlusText String
Example:
no setter
text String
If fractionDigits is 0, the value is formatted with no decimal places. Otherwise, it is formatted with the specified number of decimal places, and trailing zeros are removed.
no setter
toReadableBytes Readable
Converts the number to a human-readable byte format.
no setter
toReadableNumber Readable
Converts the number to a human-readable number format.
no setter

Methods

toPercentageText([String sign = "%"]) String
Example:
toPlusText([String sign = "+"]) String
Example:
toText([int fractionDigits = 2]) String
If fractionDigits is 0, the value is formatted with no decimal places. Otherwise, it is formatted with the specified number of decimal places, and trailing zeros are removed.