NumberFormat (Java SE 26 & JDK 26)
- All Implemented Interfaces:
Serializable, Cloneable
- Direct Known Subclasses:
ChoiceFormat, CompactNumberFormat, DecimalFormat
-
Nested Class Summary
Nested Classes
static classDefines constants that are used as attribute keys in the
AttributedCharacterIteratorreturned fromNumberFormat.formatToCharacterIteratorand as field identifiers inFieldPosition.static enum -
Field Summary
Fields
static final intField constant used to construct a FieldPosition object.
static final intField constant used to construct a FieldPosition object.
-
Constructor Summary
Constructors
-
Method Summary
clone()booleanCompares the specified object with this
NumberFormatfor equality.format(double number) Specialization of format.
Specialization of format.
format(long number) Specialization of format.
Specialization of format.
Formats a number and appends the resulting text to the given string buffer.
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.
inthashCode()Returns the hash code for this
NumberFormat.booleanReturns true if grouping is used in this format.
booleanReturns
trueif this format will parse numbers as integers only.booleanisStrict()Returns
trueif this format will parse numbers strictly;falseotherwise.Parses text from the beginning of the given string to produce a
Number.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.
voidsetGroupingUsed(boolean newValue) Set 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.
voidsetParseIntegerOnly(boolean value) Sets whether or not numbers should be parsed as integers only.
voidvoidsetStrict(boolean strict) Change the leniency value for parsing.
Methods declared in class Format
format, formatToCharacterIterator, parseObjectFormats an object to produce a string.
Formats an Object producing an
AttributedCharacterIterator.Parses text from the beginning of the given string to produce an object.
Methods declared in class Object
finalize, getClass, notify, notifyAll, toString, 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.
Returns a string representation of the object.
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.
-
Field Details
-
INTEGER_FIELD
-
FRACTION_FIELD
-
-
Constructor Details
-
NumberFormat
-
-
Method Details
-
format
-
parseObject
-
format
-
format
-
format
-
format
-
parse
-
parse
-
isParseIntegerOnly
-
setParseIntegerOnly
-
isStrict
-
setStrict
-
getInstance
-
getInstance
-
getNumberInstance
-
getNumberInstance
-
getIntegerInstance
-
getIntegerInstance
-
getCurrencyInstance
-
getCurrencyInstance
-
getPercentInstance
-
getPercentInstance
-
getCompactNumberInstance
-
getCompactNumberInstance
-
getAvailableLocales
-
hashCode
-
equals
-
clone
-
isGroupingUsed
-
setGroupingUsed
-
getMaximumIntegerDigits
-
setMaximumIntegerDigits
-
getMinimumIntegerDigits
-
setMinimumIntegerDigits
-
getMaximumFractionDigits
-
setMaximumFractionDigits
-
getMinimumFractionDigits
-
setMinimumFractionDigits
-
getCurrency
-
setCurrency
-
getRoundingMode
-
setRoundingMode
-