Unit Format
class UnitFormat @JvmOverloads constructor(val name: String, val singular: Component, val plural: Component, val abbreviation: Component? = null, val defaultPrefix: MetricPrefix = MetricPrefix.NONE, val defaultStyle: Style = Style.empty())(source)
Handles formatting of a specific unit. Call format to format a value using this unit.
Parameters
name
The English name of the unit (for example 'kilograms')
singular
A component representing the long singular form of this unit (kilogram, meter, liter, etc)
plural
A component representing the long plural form of this unit (kilograms, meters, liters, etc)
abbreviation
A component representing the abbreviated form of this unit (kg, m, L, etc)
default Prefix
The prefix (kilo, nano, etc) used for this unit unless specified while formatting. For example, if you create a 'grams' unit and specify 'kilo' as the default prefix, calling format with 100 will return '100 kilograms'
default Style
The style to apply to the unit (not the value) to the output.