CompactNumberFormat (Java SE 26 & JDK 26)
- All Implemented Interfaces:
Serializable, Cloneable
-
Nested Class Summary
Nested classes/interfaces declared in class NumberFormat
NumberFormat.Field, NumberFormat.Stylestatic classDefines constants that are used as attribute keys in the
AttributedCharacterIteratorreturned fromNumberFormat.formatToCharacterIteratorand as field identifiers inFieldPosition.static enum -
Field Summary
Fields declared in class NumberFormat
static final intField constant used to construct a FieldPosition object.
static final intField constant used to construct a FieldPosition object.
-
Constructor Summary
Constructors
Creates a
CompactNumberFormatusing the given decimal pattern, decimal format symbols and compact patterns.Creates a
CompactNumberFormatusing the given decimal pattern, decimal format symbols, compact patterns, and plural rules. -
Method Summary
clone()Creates and returns a copy of this
CompactNumberFormatinstance.booleanCompares the specified object with this
CompactNumberFormatfor equality.Formats a double to produce a string representing its compact form.
Formats a long to produce a string representing its compact form.
Formats a number to produce a string representing its compact form.
Formats an Object producing an
AttributedCharacterIterator.intReturns the grouping size.
inthashCode()Returns the hash code for this
CompactNumberFormat.booleanReturns true if grouping is used in this format.
booleanReturns whether the
parse(String, ParsePosition)method returnsBigDecimal.booleanReturns true if this format parses only an integer from the number component of a compact number.
booleanisStrict()Returns
trueif this format will parse numbers strictly;falseotherwise.Parses text from the beginning of the given string to produce a
Number.voidsetGroupingSize(int newValue) voidsetGroupingUsed(boolean newValue) Sets whether or not grouping will be used in this format.
voidsetMaximumFractionDigits(int newValue) Sets the maximum number of digits allowed in the fraction portion of a number during formatting.
voidsetMaximumIntegerDigits(int newValue) Sets the maximum number of digits allowed in the integer portion of a number during formatting.
voidsetMinimumFractionDigits(int newValue) Sets the minimum number of digits allowed in the fraction portion of a number during formatting.
voidsetMinimumIntegerDigits(int newValue) Sets the minimum number of digits allowed in the integer portion of a number during formatting.
voidsetParseBigDecimal(boolean newValue) Sets whether the
parse(String, ParsePosition)method returnsBigDecimal.voidsetParseIntegerOnly(boolean value) Sets whether or not this format parses only an integer from the number component of a compact number.
voidvoidsetStrict(boolean strict) Change the leniency value for parsing.
toString()Returns a string identifying this
CompactNumberFormat, for debugging.Methods declared in class NumberFormat
format, format, getAvailableLocales, getCompactNumberInstance, getCompactNumberInstance, getCurrency, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, parse, parseObject, setCurrencySpecialization of format.
Specialization of format.
Returns an array of all locales for which the
get*Instancemethods of this class can return localized instances.Gets the currency used by this number format when formatting currency values.
Returns a currency format for the current default
FORMATlocale.Returns a currency format for the specified locale.
Returns a general-purpose number format for the current default
FORMATlocale.Returns a general-purpose number format for the specified locale.
Returns an integer number format for the current default
FORMATlocale.Returns an integer number format for the specified locale.
intReturns the maximum number of digits allowed in the fraction portion of a number during formatting.
intReturns the maximum number of digits allowed in the integer portion of a number during formatting.
intReturns the minimum number of digits allowed in the fraction portion of a number during formatting.
intReturns the minimum number of digits allowed in the integer portion of a number during formatting.
Returns a general-purpose number format for the current default
FORMATlocale.Returns a general-purpose number format for the specified locale.
Returns a percentage format for the current default
FORMATlocale.Returns a percentage format for the specified locale.
Parses text from the beginning of the given string to produce a
Number.Parses text from the given string to produce an object.
voidSets the currency used by this number format when formatting currency values.
Methods declared in class Format
Formats an object to produce a string.
Parses text from the beginning of the given string to produce an object.
Methods declared in class Object
finalize, getClass, notify, notifyAll, wait, wait, waitprotected voidDeprecated, for removal: This API element is subject to removal in a future version.
Returns the runtime class of this
Object.final voidWakes up a single thread that is waiting on this object's monitor.
final voidWakes up all threads that are waiting on this object's monitor.
final voidCauses the current thread to wait until it is awakened, typically by being notified or interrupted.
final voidwait(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 voidwait(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.
-
Constructor Details
-
CompactNumberFormat
-
CompactNumberFormat
-
-
Method Details
-
format
-
format
-
format
-
formatToCharacterIterator
-
parse
-
setMaximumIntegerDigits
-
setMinimumIntegerDigits
-
setMinimumFractionDigits
-
setMaximumFractionDigits
-
getRoundingMode
-
setRoundingMode
-
getGroupingSize
-
setGroupingSize
-
isGroupingUsed
-
setGroupingUsed
-
isParseIntegerOnly
-
setParseIntegerOnly
-
isStrict
-
setStrict
-
isParseBigDecimal
-
setParseBigDecimal
-
equals
-
hashCode
-
toString
-
clone
-