Class NumberFormatting
java.lang.Object
com.vmware.vipclient.i18n.base.instances.NumberFormatting
- All Implemented Interfaces:
Formatting,I18n
Provides functions to get the formatted number, percent, currency and so on.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionformat(Object value, Integer fractionSize, String currencyCode, String language, String region, int style) Returns a specific style number format or currency format with specified fractionSize for a specific locale.Returns a specific style number format with specified fractionSize for a specific locale.Returns a specific style number format for a specific locale.formatCurrency(Object amount, String language, String region) formatCurrency(Object amount, String currencyCode, String language, String region) Format a number to an localized number string with currency symbol specified by 3-letter currency code according to locale's currency format defined in cldr.formatCurrency(Object amount, String currencyCode, Locale locale) Format a number to an localized number string with currency symbol specified by 3-letter currency code according to locale's currency format defined in cldr.formatCurrency(Object amount, Locale locale) Format a number to an localized number string with default currency symbol($) according to locale's currency format defined in cldr.formatNumber(Object value, Integer fractionSize, String language, String region) Format a number to an localized number string in decimal style using user self defined fraction size.formatNumber(Object value, Integer fractionSize, Locale locale) Format a number to an localized number string in decimal style using user self defined fraction size.formatNumber(Object value, String language, String region) formatNumber(Object value, Locale locale) Format a number to an localized number string in decimal style according to locale's decimal format defined in cldr.formatPercent(Object value, Integer fractionSize, String language, String region) Format a number to an localized number string in percent style using user self defined fraction size.formatPercent(Object value, Integer fractionSize, Locale locale) Format a number to an localized number string in percent style using user self defined fraction size.formatPercent(Object value, String language, String region) formatPercent(Object value, Locale locale) Format a number to an localized number string in percent style according to locale's percent format defined in cldr.
-
Constructor Details
-
NumberFormatting
public NumberFormatting()
-
-
Method Details
-
formatNumber
Format a number to an localized number string in decimal style according to locale's decimal format defined in cldr. Default fraction size in cldr decimal format is: the minimum is 0, the maximum is 3.- Parameters:
value- The number to be formatted.locale- The locale for which the number format is desired.- Returns:
- The formatted number string.
-
formatNumber
-
formatNumber
Format a number to an localized number string in decimal style using user self defined fraction size. cldr decimal format's fraction size will be ignored.- Parameters:
value- The number to be formatted.fractionSize- User self defined fraction size.locale- The locale for which the number format is desired.- Returns:
- The formatted number string.
-
formatNumber
Format a number to an localized number string in decimal style using user self defined fraction size. cldr decimal format's fraction size will be ignored.- Parameters:
value- The number to be formatted.fractionSize- User self defined fraction size.language- The language for which the number format is desired.region- The region for which the number format is desired.- Returns:
- The formatted number string.
-
formatPercent
Format a number to an localized number string in percent style according to locale's percent format defined in cldr. Default fraction size in cldr percent format is 0.- Parameters:
value- The number to be formatted.locale- The locale for which the percent format is desired.- Returns:
- The formatted percent string.
-
formatPercent
-
formatPercent
Format a number to an localized number string in percent style using user self defined fraction size. cldr percent format's fraction size will be ignored.- Parameters:
value- The number to be formatted.fractionSize- User self defined fraction size.locale- The locale for which the percent format is desired.- Returns:
- The formatted percent string.
-
formatPercent
Format a number to an localized number string in percent style using user self defined fraction size. cldr percent format's fraction size will be ignored.- Parameters:
value- The number to be formatted.fractionSize- User self defined fraction size.language- The language for which the number format is desired.region- The region for which the number format is desired.- Returns:
- The formatted percent string.
-
formatCurrency
Format a number to an localized number string with default currency symbol($) according to locale's currency format defined in cldr. Default fraction size in cldr currency format is 2.- Parameters:
amount- The number to be formatted.locale- The locale for which the currency format is desired.- Returns:
- The formatted currency string.
-
formatCurrency
-
formatCurrency
Format a number to an localized number string with currency symbol specified by 3-letter currency code according to locale's currency format defined in cldr. Default fraction size in cldr currency format is 2.- Parameters:
amount- The number to be formatted.currencyCode- ISO 4217 3-letter code. For all legal code please refer to https://en.wikipedia.org/wiki/ISO_4217.locale- The locale for which the currency format is desired.- Returns:
- The formatted currency string.
-
formatCurrency
Format a number to an localized number string with currency symbol specified by 3-letter currency code according to locale's currency format defined in cldr. Default fraction size in cldr currency format is 2.- Parameters:
amount- The number to be formatted.currencyCode- ISO 4217 3-letter code. For all legal code please refer to https://en.wikipedia.org/wiki/ISO_4217.language- The language for which the number format is desired.region- The region for which the number format is desired.- Returns:
- The formatted currency string.
-
format
Returns a specific style number format for a specific locale.- Parameters:
value-locale-style- number format style, currently only support NUMBERSTYLE, PERCENTSTYLE, CURRENCYSTYLE,- Returns:
-
format
-
format
Returns a specific style number format with specified fractionSize for a specific locale.- Parameters:
value-fractionSize-locale-style- number format style, currently only support NUMBERSTYLE, PERCENTSTYLE, CURRENCYSTYLE,- Returns:
-
format
-
format
public String format(Object value, Integer fractionSize, String currencyCode, Locale locale, int style) Returns a specific style number format or currency format with specified fractionSize for a specific locale.- Parameters:
value-fractionSize-currencyCode-locale-style- number format style, currently only support NUMBERSTYLE, PERCENTSTYLE, CURRENCYSTYLE,- Returns:
-
format
-