Class sap.ca.ui.model.format.QuantityFormatModule: sap/ca/ui/model/format/QuantityFormat


The QuantityFormat is a static class for formatting and parsing file size values according to a set of format options.

If no pattern is specified a default pattern according to the locale settings is used.

Deprecated API:Deprecated API:Since version 1.28. There is no replacement for the QuantityFormat in sap.ui.core.format. Please refer to sap.ui.core.format and set the minFractionDigits and maxFractionDigits on the formatter as required. This control will not be supported anymore.

Constructor Summary
new sap.ca.ui.model.format.QuantityFormat()Constructor for QuantityFormat - must not be used: To get a QuantityFormat instance, please use getInstance.
Method Summary
sap.ca.ui.model.format.QuantityFormat.FormatQuantityShort(sValue, unitCode, decimals)Convenience static function Format an quantity in short Style.
sap.ca.ui.model.format.QuantityFormat.FormatQuantityStandard(sValue, unitCode, decimals)Convenience static function Format an quantity in standard Style.
sap.ca.ui.model.format.QuantityFormat.getInstance(oFormatOptions?, oLocale?)Get a instance of the QuantityFormat, which can be used for formatting.
format(oValue)Format a value according to the given format options.
parse(sValue)Parse a string which is formatted according to the given format options.
Constructor Detail
new sap.ca.ui.model.format.QuantityFormat()
Constructor for QuantityFormat - must not be used: To get a QuantityFormat instance, please use getInstance.
Deprecated:
Deprecated API:Since version 1.28. There is no replacement for the QuantityFormat in sap.ui.core.format. Please refer to sap.ui.core.format and set the minFractionDigits and maxFractionDigits on the formatter as required. This control will not be supported anymore.
Method Detail
sap.ca.ui.model.format.QuantityFormat.FormatQuantityShort(sValue, unitCode, decimals): string
Convenience static function Format an quantity in short Style. Number of decimals will be set : Using Decimals if specified else using the standard number of decimal for the given unit
Parameters:
{string}sValue the string containing a formatted value
{string}unitCode
{string}decimals
Returns:
{string} the formatted value
sap.ca.ui.model.format.QuantityFormat.FormatQuantityStandard(sValue, unitCode, decimals): string
Convenience static function Format an quantity in standard Style. Number of decimals will be set : Using Decimals if specified else using the standard number of decimal for the given unit
Parameters:
{string}sValue the string containing a formatted value
{string}unitCode
{string}decimals
Returns:
{string} the formatted value
sap.ca.ui.model.format.QuantityFormat.getInstance(oFormatOptions?, oLocale?): sap.ca.ui.model.format.QuantityFormat
Get a instance of the QuantityFormat, which can be used for formatting.
Parameters:
{object}oFormatOptions? Object which defines the format options
{string}oFormatOptions.style? either empty or 'standard or 'short'. If no pattern is given, a locale dependent default pattern of that style is used from the LocaleData class.
{sap.ui.core.Locale}oLocale? Locale to ask for locale specific texts/settings
Returns:
{sap.ca.ui.model.format.QuantityFormat} instance of the QuantityFormat
format(oValue): string
Format a value according to the given format options.
Parameters:
{object}oValue the value to format
Returns:
{string} the formatted output value
parse(sValue): number
Parse a string which is formatted according to the given format options.
Parameters:
{string}sValue the string containing a formatted value
Returns:
{number} the parsed value