CompactDecimalFormat


public class CompactDecimalFormat
extends DecimalFormat

java.lang.Object
   ↳ java.text.Format
     ↳ android.icu.text.UFormat
       ↳ android.icu.text.NumberFormat
         ↳ android.icu.text.DecimalFormat
           ↳ android.icu.text.CompactDecimalFormat


Formats numbers in compact (abbreviated) notation, like "1.2K" instead of "1200".

IMPORTANT: New users are strongly encouraged to see if NumberFormatter fits their use case. Although not deprecated, this class, CompactDecimalFormat, is provided for backwards compatibility only.


The CompactDecimalFormat produces abbreviated numbers, suitable for display in environments will limited real estate. For example, 'Hits: 1.2B' instead of 'Hits: 1,200,000,000'. The format will be appropriate for the given language, such as "1,2 Mrd." for German.

For numbers under 1000 trillion (under 10^15, such as 123,456,789,012,345), the result will be short for supported languages. However, the result may sometimes exceed 7 characters, such as when there are combining marks or thin characters. In such cases, the visual width in fonts should still be short.

By default, there are 2 significant digits. After creation, if more than three significant digits are set (with setMaximumSignificantDigits), or if a fixed number of digits are set (with setMaximumIntegerDigits or setMaximumFractionDigits), then result may be wider.

The "short" style is also capable of formatting currency amounts, such as "$1.2M" instead of "$1,200,000.00" (English) or "5,3 Mio. \u20ac" instead of "5.300.000,00 \u20ac" (German). Localized data concerning longer formats is not available yet in the Unicode CLDR. Because of this, attempting to format a currency amount using the "long" style will produce an UnsupportedOperationException.

At this time, negative numbers and parsing are not supported, and will produce an UnsupportedOperationException. Resetting the pattern prefixes or suffixes is not supported; the method calls are ignored.

Note that important methods, like setting the number of decimals, will be moved up from DecimalFormat to NumberFormat.

Summary

Inherited constants

int MINIMUM_GROUPING_DIGITS_AUTO

[icu] Constant for setMinimumGroupingDigits(int) to specify display grouping using the default strategy for all locales.

int MINIMUM_GROUPING_DIGITS_MIN2

[icu] Constant for setMinimumGroupingDigits(int) to specify display grouping using locale defaults, except do not show grouping on values smaller than 10000 (such that there is a minimum of two digits before the first separator).

int PAD_AFTER_PREFIX

[icu] Constant for getPadPosition() and setPadPosition(int) to specify pad characters inserted after the prefix.

int PAD_AFTER_SUFFIX

[icu] Constant for getPadPosition() and setPadPosition(int) to specify pad characters inserted after the suffix.

int PAD_BEFORE_PREFIX

[icu] Constant for getPadPosition() and setPadPosition(int) to specify pad characters inserted before the prefix.

int PAD_BEFORE_SUFFIX

[icu] Constant for getPadPosition() and setPadPosition(int) to specify pad characters inserted before the suffix.

int ACCOUNTINGCURRENCYSTYLE

[icu] Constant to specify currency style of format which uses currency symbol to represent currency for accounting, for example: "($3.00), instead of "-$3.00" (CURRENCYSTYLE).

int CASHCURRENCYSTYLE

[icu] Constant to specify currency cash style of format which uses currency ISO code to represent currency, for example: "NT$3" instead of "NT$3.23".

int CURRENCYSTYLE

[icu] Constant to specify general currency style of format.

int FRACTION_FIELD

Field constant used to construct a FieldPosition object.

int INTEGERSTYLE

[icu] Constant to specify a integer number style format.

int INTEGER_FIELD

Field constant used to construct a FieldPosition object.

int ISOCURRENCYSTYLE

[icu] Constant to specify currency style of format which uses currency ISO code to represent currency, for example: "USD3.00".

int NUMBERSTYLE

[icu] Constant to specify normal number style of format.

int PERCENTSTYLE

[icu] Constant to specify a style of format to display percent.

int PLURALCURRENCYSTYLE

[icu] Constant to specify currency style of format which uses currency long name with plural format to represent currency, for example, "3.00 US Dollars".

int SCIENTIFICSTYLE

[icu] Constant to specify a style of format to display scientific number.

int STANDARDCURRENCYSTYLE

[icu] Constant to specify currency style of format which uses currency symbol to represent currency, for example "$3.00", using non-accounting style for negative values (e.g.

Public methods

static CompactDecimalFormat getInstance(ULocale locale, CompactDecimalFormat.CompactStyle style)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static CompactDecimalFormat getInstance(Locale locale, CompactDecimalFormat.CompactStyle style)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

Number parse(String text, ParsePosition parsePosition)

Parsing is currently unsupported, and throws an UnsupportedOperationException.

CurrencyAmount parseCurrency(CharSequence text, ParsePosition parsePosition)

Parsing is currently unsupported, and throws an UnsupportedOperationException.

Inherited methods

void applyLocalizedPattern(String localizedPattern)

Converts the given string to standard notation and then parses it using applyPattern(String).

void applyPattern(String pattern)

Parses the given pattern string and overwrites the settings specified in the pattern string.

boolean areSignificantDigitsUsed()

[icu] Returns whether significant digits are being used in rounding.

Object clone()

Overrides clone.

boolean equals(Object obj)

Tests for equality between this formatter and another formatter.

StringBuffer format(BigInteger number, StringBuffer result, FieldPosition fieldPosition)

[icu] Formats a BigInteger.

StringBuffer format(CurrencyAmount currAmt, StringBuffer result, FieldPosition fieldPosition)

[icu] Formats a CurrencyAmount.

StringBuffer format(BigDecimal number, StringBuffer result, FieldPosition fieldPosition)

[icu] Formats an ICU BigDecimal.

StringBuffer format(double number, StringBuffer result, FieldPosition fieldPosition)

Specialization of format.

StringBuffer format(BigDecimal number, StringBuffer result, FieldPosition fieldPosition)

[icu] Formats a BigDecimal.

StringBuffer format(long number, StringBuffer result, FieldPosition fieldPosition)

Specialization of format.

AttributedCharacterIterator formatToCharacterIterator(Object obj)

Formats an Object producing an AttributedCharacterIterator.

Currency getCurrency()

Returns the currency used to display currency amounts.

CurrencyPluralInfo getCurrencyPluralInfo()

[icu] Returns the current instance of CurrencyPluralInfo.

Currency.CurrencyUsage getCurrencyUsage()

[icu] Returns the strategy for rounding currency amounts.

DecimalFormatSymbols getDecimalFormatSymbols()

Returns a copy of the decimal format symbols used by this formatter.

int getFormatWidth()

Returns the minimum number of characters in formatted output.

int getGroupingSize()

Returns the primary grouping size in use.

MathContext getMathContext()

[icu] Returns the MathContext being used to round numbers.

MathContext getMathContextICU()

[icu] Returns the MathContext being used to round numbers.

int getMaximumFractionDigits()

Returns the effective maximum number of integer digits after the decimal separator.

int getMaximumIntegerDigits()

Returns the effective maximum number of digits before the decimal separator.

int getMaximumSignificantDigits()

[icu] Returns the effective maximum number of significant digits displayed.

byte getMinimumExponentDigits()

[icu] Returns the minimum number of digits printed in the exponent in scientific notation.

int getMinimumFractionDigits()

Returns the effective minimum number of integer digits after the decimal separator.

int getMinimumGroupingDigits()

[icu] Returns the minimum number of digits before grouping is triggered.

int getMinimumIntegerDigits()

Returns the effective minimum number of digits before the decimal separator.

int getMinimumSignificantDigits()

[icu] Returns the effective minimum number of significant digits displayed.

int getMultiplier()

Returns the multiplier being applied to numbers before they are formatted.

String getNegativePrefix()

Affixes: Gets the negative prefix string currently being used to format numbers.

String getNegativeSuffix()

Affixes: Gets the negative suffix string currently being used to format numbers.

char getPadCharacter()

[icu] Returns the character used for padding.

int getPadPosition()

[icu] Returns the position used for padding.

int getParseMaxDigits()

This method was deprecated in API level 28. Setting max parse digits has no effect since ICU4J 59.

String getPositivePrefix()

Affixes: Gets the positive prefix string currently being used to format numbers.

String getPositiveSuffix()

Affixes: Gets the positive suffix string currently being used to format numbers.

BigDecimal getRoundingIncrement()

[icu] Returns the increment to which numbers are being rounded.

int getRoundingMode()

Returns the rounding mode being used to round numbers.

int getSecondaryGroupingSize()

[icu] Returns the secondary grouping size in use.

int hashCode()

Returns a hash code value for the object.

boolean isDecimalPatternMatchRequired()

[icu] Returns whether the presence of a decimal point must match the pattern.

boolean isDecimalSeparatorAlwaysShown()

Returns whether the decimal separator is shown on integers.

boolean isExponentSignAlwaysShown()

[icu] Returns whether the sign (plus or minus) is always printed in scientific notation.

boolean isGroupingUsed()

Returns whether or not grouping separators are being printed in the output.

boolean isParseBigDecimal()

Returns whether NumberFormat.parse(String) will always return a BigDecimal.

boolean isParseCaseSensitive()

[icu] Returns whether to force case (uppercase/lowercase) to match when parsing.

boolean isParseIntegerOnly()

Returns true if this format will parse numbers as integers only.

boolean isParseNoExponent()

[icu] Returns whether to ignore exponents when parsing.

boolean isParseStrict()

[icu] Returns whether strict parsing is in effect.

boolean isScientificNotation()

[icu] Returns whether scientific (exponential) notation is enabled on this formatter.

boolean isSignAlwaysShown()

[icu] Returns whether the sign is being shown on positive numbers.

Number parse(String text, ParsePosition parsePosition)

Returns a Long if possible (e.g., within the range [Long.MIN_VALUE, Long.MAX_VALUE] and with no decimals); otherwise, returns another type, such as a BigDecimal, BigInteger, or Double.

CurrencyAmount parseCurrency(CharSequence text, ParsePosition parsePosition)

Parses text from the given string as a CurrencyAmount.

void setCurrency(Currency currency)

Sets the currency to be used when formatting numbers.

void setCurrencyPluralInfo(CurrencyPluralInfo newInfo)

[icu] Sets a custom instance of CurrencyPluralInfo.

void setCurrencyUsage(Currency.CurrencyUsage usage)

[icu] Sets the currency-dependent strategy to use when rounding numbers.

void setDecimalFormatSymbols(DecimalFormatSymbols newSymbols)

Sets the decimal format symbols used by this formatter.

void setDecimalPatternMatchRequired(boolean value)

[icu] Parsing: This method is used to either require or forbid the presence of a decimal point in the string being parsed (disabled by default).

void setDecimalSeparatorAlwaysShown(boolean value)

Separators: Sets whether the decimal separator (a period in en-US) is shown on integers.

void setExponentSignAlwaysShown(boolean expSignAlways)

[icu] Scientific Notation: Sets whether the sign (plus or minus) is always to be shown in the exponent in scientific notation.

void setFormatWidth(int width)

Padding: Sets the minimum width of the string output by the formatting pipeline.

void setGroupingSize(int width)

Grouping: Sets the primary grouping size (distance between grouping separators) used when formatting large numbers.

void setGroupingUsed(boolean enabled)

Grouping: Sets whether grouping is to be used when formatting numbers.

void setMathContext(MathContext mathContext)

[icu] Rounding and Digit Limits: Sets the MathContext used to round numbers.

void setMathContextICU(MathContext mathContextICU)

[icu] Rounding and Digit Limits: Overload of setMathContext(MathContext) for MathContext.

void setMaximumFractionDigits(int value)

Rounding and Digit Limits: Sets the maximum number of digits to display after the decimal separator.

void setMaximumIntegerDigits(int value)

Rounding and Digit Limits: Sets the maximum number of digits to display before the decimal separator.

void setMaximumSignificantDigits(int value)

[icu] Rounding and Digit Limits: Sets the maximum number of significant digits to be displayed.

void setMinimumExponentDigits(byte minExpDig)

[icu] Scientific Notation: Sets the minimum number of digits to be printed in the exponent.

void setMinimumFractionDigits(int value)

Rounding and Digit Limits: Sets the minimum number of digits to display after the decimal separator.

void setMinimumGroupingDigits(int number)

[icu] Sets the minimum number of digits that must be before the first grouping separator in order for the grouping separator to be printed.

void setMinimumIntegerDigits(int value)

Rounding and Digit Limits: Sets the minimum number of digits to display before the decimal separator.

void setMinimumSignificantDigits(int value)

[icu] Rounding and Digit Limits: Sets the minimum number of significant digits to be displayed.

void setMultiplier(int multiplier)

Sets a number that will be used to multiply all numbers prior to formatting.

void setNegativePrefix(String prefix)

Affixes: Sets the string to prepend to negative numbers.

void setNegativeSuffix(String suffix)

Affixes: Sets the string to append to negative numbers.

void setPadCharacter(char padChar)

[icu] Padding: Sets the character used to pad numbers that are narrower than the width specified in setFormatWidth(int).

void setPadPosition(int padPos)

[icu] Padding: Sets the position where to insert the pad character when narrower than the width specified in setFormatWidth(int).

void setParseBigDecimal(boolean value)

Whether to make NumberFormat.parse(String) prefer returning a BigDecimal when possible.

void setParseCaseSensitive(boolean value)

[icu] Specifies whether parsing should require cases to match in affixes, exponent separators, and currency codes.

void setParseIntegerOnly(boolean parseIntegerOnly)

Parsing: Sets whether to ignore the fraction part of a number when parsing (defaults to false).

This is functionally equivalent to calling setDecimalPatternMatchRequired(boolean) and a pattern without a decimal point.

void setParseMaxDigits(int maxDigits)

This method was deprecated in API level 28. Setting max parse digits has no effect since ICU4J 59.

void setParseNoExponent(boolean value)

[icu] Specifies whether to stop parsing when an exponent separator is encountered.

void setParseStrict(boolean parseStrict)

[icu] Sets whether strict parsing is in effect.

void setPositivePrefix(String prefix)

Affixes: Sets the string to prepend to positive numbers.

void setPositiveSuffix(String suffix)

Affixes: Sets the string to append to positive numbers.

void setRoundingIncrement(BigDecimal increment)

[icu] Rounding and Digit Limits: Sets an increment, or interval, to which numbers are rounded.

void setRoundingIncrement(BigDecimal increment)

[icu] Rounding and Digit Limits: Overload of setRoundingIncrement(java.math.BigDecimal).

void setRoundingIncrement(double increment)

[icu] Rounding and Digit Limits: Overload of setRoundingIncrement(java.math.BigDecimal).

void setRoundingMode(int roundingMode)

Rounding and Digit Limits: Sets the RoundingMode used to round numbers.

void setScientificNotation(boolean useScientific)

[icu] Scientific Notation: Sets whether this formatter should print in scientific (exponential) notation.

void setSecondaryGroupingSize(int width)

[icu] Grouping: Sets the secondary grouping size (distance between grouping separators after the first separator) used when formatting large numbers.

void setSignAlwaysShown(boolean value)

Sets whether to always shown the plus sign ('+' in en) on positive numbers.

void setSignificantDigitsUsed(boolean useSignificantDigits)

[icu] Rounding and Digit Limits: Sets whether significant digits are to be used in rounding.

String toLocalizedPattern()

Calls toPattern() and converts the string to localized notation.

String toPattern()

Serializes this formatter object to a decimal format pattern string.

String toString()

Returns the default value of toString() with extra DecimalFormat-specific information appended to the end of the string.

Object clone()

Overrides clone.

boolean equals(Object obj)

Overrides equals.

abstract StringBuffer format(BigInteger number, StringBuffer toAppendTo, FieldPosition pos)

[icu] Formats a BigInteger.

abstract StringBuffer format(BigDecimal number, StringBuffer toAppendTo, FieldPosition pos)

[icu] Formats an ICU BigDecimal.

StringBuffer format(Object number, StringBuffer toAppendTo, FieldPosition pos)

Formats a number and appends the resulting text to the given string buffer.

final String format(BigDecimal number)

Convenience method to format a BigDecimal.

abstract StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos)

Specialization of format.

abstract StringBuffer format(BigDecimal number, StringBuffer toAppendTo, FieldPosition pos)

[icu] Formats a BigDecimal.

final String format(BigInteger number)

[icu] Convenience method to format a BigInteger.

final String format(BigDecimal number)

[icu] Convenience method to format an ICU BigDecimal.

final String format(double number)

Specialization of format.

final String format(long number)

Specialization of format.

StringBuffer format(CurrencyAmount currAmt, StringBuffer toAppendTo, FieldPosition pos)

[icu] Formats a CurrencyAmount.

final String format(CurrencyAmount currAmt)

[icu] Convenience method to format a CurrencyAmount.

abstract StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos)

Specialization of format.

static Locale[] getAvailableLocales()

Returns the list of Locales for which NumberFormats are available.

DisplayContext getContext(DisplayContext.Type type)

[icu] Get the formatter's DisplayContext value for the specified DisplayContext.Type, such as CAPITALIZATION.

Currency getCurrency()

Returns the Currency object used to display currency amounts.

static NumberFormat getCurrencyInstance(Locale inLocale)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static NumberFormat getCurrencyInstance(ULocale inLocale)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static final NumberFormat getCurrencyInstance()

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static final NumberFormat getInstance()

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static NumberFormat getInstance(Locale inLocale)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static NumberFormat getInstance(ULocale desiredLocale, int choice)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static NumberFormat getInstance(Locale inLocale, int style)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static NumberFormat getInstance(ULocale inLocale)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static final NumberFormat getInstance(int style)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static NumberFormat getIntegerInstance(ULocale inLocale)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static final NumberFormat getIntegerInstance()

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static NumberFormat getIntegerInstance(Locale inLocale)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

int getMaximumFractionDigits()

Returns the maximum number of digits allowed in the fraction portion of a number.

int getMaximumIntegerDigits()

Returns the maximum number of digits allowed in the integer portion of a number.

int getMinimumFractionDigits()

Returns the minimum number of digits allowed in the fraction portion of a number.

int getMinimumIntegerDigits()

Returns the minimum number of digits allowed in the integer portion of a number.

static NumberFormat getNumberInstance(ULocale inLocale)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static final NumberFormat getNumberInstance()

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static NumberFormat getNumberInstance(Locale inLocale)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static String getPattern(ULocale forLocale, int choice)

Returns the pattern for the provided locale and choice.

static final NumberFormat getPercentInstance()

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static NumberFormat getPercentInstance(Locale inLocale)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static NumberFormat getPercentInstance(ULocale inLocale)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

int getRoundingMode()

Returns the rounding mode used in this NumberFormat.

static NumberFormat getScientificInstance(ULocale inLocale)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static NumberFormat getScientificInstance(Locale inLocale)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

static final NumberFormat getScientificInstance()

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.

int hashCode()

Returns a hash code value for the object.

boolean isGroupingUsed()

Returns true if grouping is used in this format.

boolean isParseIntegerOnly()

Returns true if this format will parse numbers as integers only.

boolean isParseStrict()

[icu] Returns whether strict parsing is in effect.

Number parse(String text)

Parses text from the beginning of the given string to produce a number.

abstract Number parse(String text, ParsePosition parsePosition)

Returns a Long if possible (e.g., within the range [Long.MIN_VALUE, Long.MAX_VALUE] and with no decimals); otherwise, returns another type, such as a BigDecimal, BigInteger, or Double.

CurrencyAmount parseCurrency(CharSequence text, ParsePosition pos)

Parses text from the given string as a CurrencyAmount.

final Object parseObject(String source, ParsePosition parsePosition)

Parses text from a string to produce a number.

void setContext(DisplayContext context)

[icu] Set a particular DisplayContext value in the formatter, such as CAPITALIZATION_FOR_STANDALONE.

void setCurrency(Currency theCurrency)

Sets the Currency object used to display currency amounts.

void setGroupingUsed(boolean newValue)

Sets whether or not grouping will be used in this format.

void setMaximumFractionDigits(int newValue)

Sets the maximum number of digits allowed in the fraction portion of a number.

void setMaximumIntegerDigits(int newValue)

Sets the maximum number of digits allowed in the integer portion of a number.

void setMinimumFractionDigits(int newValue)

Sets the minimum number of digits allowed in the fraction portion of a number.

void setMinimumIntegerDigits(int newValue)

Sets the minimum number of digits allowed in the integer portion of a number.

void setParseIntegerOnly(boolean value)

Sets whether to ignore the fraction part of a number when parsing (defaults to false).

void setParseStrict(boolean value)

[icu] Sets whether strict parsing is in effect.

void setRoundingMode(int roundingMode)

Set the rounding mode used in this NumberFormat.

Object clone()

Creates and returns a copy of this object.

final String format(Object obj)

Formats an object to produce a string.

abstract StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)

Formats an object and appends the resulting text to a given string buffer.

AttributedCharacterIterator formatToCharacterIterator(Object obj)

Formats an Object producing an AttributedCharacterIterator.

Object parseObject(String source)

Parses text from the beginning of the given string to produce an object.

abstract Object parseObject(String source, ParsePosition pos)

Parses text from a string to produce an object.

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public methods

getInstance

Added in API level 24
public static CompactDecimalFormat getInstance (ULocale locale, 
                CompactDecimalFormat.CompactStyle style)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.


Creates a CompactDecimalFormat appropriate for a locale. The result may be affected by the number system in the locale, such as ar-u-nu-latn.

Parameters
locale ULocale: the desired locale

style CompactDecimalFormat.CompactStyle: the compact style

getInstance

Added in API level 24
public static CompactDecimalFormat getInstance (Locale locale, 
                CompactDecimalFormat.CompactStyle style)

NOTE: New users are strongly encouraged to use NumberFormatter instead of NumberFormat.


Creates a CompactDecimalFormat appropriate for a locale. The result may be affected by the number system in the locale, such as ar-u-nu-latn.

Parameters
locale Locale: the desired locale

style CompactDecimalFormat.CompactStyle: the compact style

parse

Added in API level 24
public Number parse (String text, 
                ParsePosition parsePosition)

Parsing is currently unsupported, and throws an UnsupportedOperationException.

Parameters
text String

parsePosition ParsePosition

Returns
Number

parseCurrency

Added in API level 24
public CurrencyAmount parseCurrency (CharSequence text, 
                ParsePosition parsePosition)

Parsing is currently unsupported, and throws an UnsupportedOperationException.

Parameters
text CharSequence: the text to parse

parsePosition ParsePosition: input-output position; on input, the position within text to match; must have 0 <= pos.getIndex() < text.length(); on output, the position after the last matched character. If the parse fails, the position in unchanged upon output.

Returns
CurrencyAmount a CurrencyAmount, or null upon failure