Class sap.ca.ui.model.format.AmountFormatModule: sap/ca/ui/model/format/AmountFormat
The AmountFormat 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. This control has been made available in sap.ui.core. Please use sap.ui.core.format.NumberFormat.getCurrencyInstance instead! This control will not be supported anymore.
Constructor Summary
new sap.ca.ui.model.format.AmountFormat()Constructor for AmountFormat - must not be used: To get a AmountFormat instance, please use getInstance.
Method Summary
sap.ca.ui.model.format.AmountFormat.FormatAmountShort(oValue, currencyCode, decimals)Convenience static function Format an amount in short Style.
sap.ca.ui.model.format.AmountFormat.FormatAmountShortWithCurrency(sValue, sCurrencyCode, decimals)Convenience static function Format an amount in short Style with the currency code according to the cldr currency format.
sap.ca.ui.model.format.AmountFormat.FormatAmountStandard(oValue, currencyCode, decimals)Convenience static function Format an amount in standard Style.
sap.ca.ui.model.format.AmountFormat.FormatAmountStandardWithCurrency(sValue, sCurrencyCode, decimals)Convenience static function Format an amount in standard Style with the currency code according to the cldr currency format.
sap.ca.ui.model.format.AmountFormat.getInstance(oFormatOptions?, oLocale?)Get a instance of the AmountFormat, which can be used for formatting.
formatWithCurrency(sValue, sCurrencyCode)Format an amount with the currency code according to the cldr currency format.
Constructor Detail
new sap.ca.ui.model.format.AmountFormat()
Constructor for AmountFormat - must not be used: To get a AmountFormat instance, please use getInstance.
- Deprecated:
- Deprecated API:Since version 1.28. This control has been made available in sap.ui.core. Please use sap.ui.core.format.NumberFormat.getCurrencyInstance instead! This control will not be supported anymore.
Method Detail
sap.ca.ui.model.format.AmountFormat.FormatAmountShort(oValue, currencyCode, decimals): string
Convenience static function Format an amount in short Style. Number of decimals for values not "shortified" will be set : Using Decimals if specified else using the standard number of decimal for the given currency if decimals == "preserve", the number of decimals of the source value will be preserved (currency not taken into account).
Parameters:
{string} | oValue | the string containing a formatted value |
{string} | currencyCode | |
{string} | decimals |
Returns:
{string} | the formatted value |
sap.ca.ui.model.format.AmountFormat.FormatAmountShortWithCurrency(sValue, sCurrencyCode, decimals): string
Convenience static function Format an amount in short Style with the currency code according to the cldr currency format. Number of decimals for values not "shortified" will be set : Using Decimals if specified else using the standard number of decimal for the given currency If decimals == "preserve", the number of decimals of the source value will be preserved (currency not taken into account).
Parameters:
{string} | sValue | the string containing a formatted value |
{string} | sCurrencyCode | |
{string} | decimals |
Returns:
{string} | the formatted value |
sap.ca.ui.model.format.AmountFormat.FormatAmountStandard(oValue, currencyCode, decimals): string
Convenience static function Format an amount in standard Style. Number of decimals will be set: Using Decimals if specified else using the standard number of decimal for the given currency if decimals == "preserve", the number of decimals of the source value will be preserved (currency not taken into account).
Parameters:
{string} | oValue | the string containing a formatted value |
{string} | currencyCode | |
{string} | decimals |
Returns:
{string} | the formatted value |
sap.ca.ui.model.format.AmountFormat.FormatAmountStandardWithCurrency(sValue, sCurrencyCode, decimals): string
Convenience static function Format an amount in standard Style with the currency code according to the cldr currency format. Number of decimals will be set: Using decimals if specified else using the standard number of decimal for the given currency if decimals == "preserve", the number of decimals of the source value will be preserved (currency not taken into account).
Parameters:
{string} | sValue | the string containing a formatted value |
{string} | sCurrencyCode | |
{string} | decimals |
Returns:
{string} | the formatted value |
sap.ca.ui.model.format.AmountFormat.getInstance(oFormatOptions?, oLocale?): sap.ca.ui.model.format.AmountFormat
Get a instance of the AmountFormat, 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.AmountFormat} | instance of the AmountFormat |
format(oValue): string
Format an amount according to the given format options.
Parameters:
{number} | oValue | the value to format |
Returns:
{string} | the formatted output value |