mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8314604: j.text.DecimalFormat behavior regarding patterns is not clear
Reviewed-by: naoto
This commit is contained in:
parent
bd477810b1
commit
86a18f5e2e
1 changed files with 20 additions and 9 deletions
|
@ -84,9 +84,18 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
|
||||||
* the {@code NumberFormat} factory methods, the pattern and symbols are
|
* the {@code NumberFormat} factory methods, the pattern and symbols are
|
||||||
* read from localized {@code ResourceBundle}s.
|
* read from localized {@code ResourceBundle}s.
|
||||||
*
|
*
|
||||||
* <h2>Patterns</h2>
|
* <h2 id="patterns">Patterns</h2>
|
||||||
*
|
*
|
||||||
* {@code DecimalFormat} patterns have the following syntax:
|
* Note: For any given {@code DecimalFormat} pattern, if the pattern is not
|
||||||
|
* in scientific notation, the maximum number of integer digits will not be
|
||||||
|
* derived from the pattern, and instead set to {@link Integer#MAX_VALUE}.
|
||||||
|
* Otherwise, if the pattern is in scientific notation, the maximum number of
|
||||||
|
* integer digits will be derived from the pattern. This derivation is detailed
|
||||||
|
* in the {@link ##scientific_notation Scientific Notation} section. This behavior
|
||||||
|
* is the typical end-user desire; {@link #setMaximumIntegerDigits(int)} can be
|
||||||
|
* used to manually adjust the maximum integer digits.
|
||||||
|
*
|
||||||
|
* <p> {@code DecimalFormat} patterns have the following syntax:
|
||||||
* <blockquote><pre>
|
* <blockquote><pre>
|
||||||
* <i>Pattern:</i>
|
* <i>Pattern:</i>
|
||||||
* <i>PositivePattern</i>
|
* <i>PositivePattern</i>
|
||||||
|
@ -245,7 +254,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
|
||||||
* </table>
|
* </table>
|
||||||
* </blockquote>
|
* </blockquote>
|
||||||
*
|
*
|
||||||
* <h3>Scientific Notation</h3>
|
* <h3 id="scientific_notation">Scientific Notation</h3>
|
||||||
*
|
*
|
||||||
* <p>Numbers in scientific notation are expressed as the product of a mantissa
|
* <p>Numbers in scientific notation are expressed as the product of a mantissa
|
||||||
* and a power of ten, for example, 1234 can be expressed as 1.234 x 10^3. The
|
* and a power of ten, for example, 1234 can be expressed as 1.234 x 10^3. The
|
||||||
|
@ -449,6 +458,8 @@ public class DecimalFormat extends NumberFormat {
|
||||||
* for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
|
* for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale.
|
||||||
* This is a convenient way to obtain a
|
* This is a convenient way to obtain a
|
||||||
* DecimalFormat when internationalization is not the main concern.
|
* DecimalFormat when internationalization is not the main concern.
|
||||||
|
* The number of maximum integer digits is usually not derived from the pattern.
|
||||||
|
* See the note in the {@link ##patterns Patterns} section for more detail.
|
||||||
* <p>
|
* <p>
|
||||||
* To obtain standard formats for a given locale, use the factory methods
|
* To obtain standard formats for a given locale, use the factory methods
|
||||||
* on NumberFormat such as getNumberInstance. These factories will
|
* on NumberFormat such as getNumberInstance. These factories will
|
||||||
|
@ -474,6 +485,8 @@ public class DecimalFormat extends NumberFormat {
|
||||||
* Creates a DecimalFormat using the given pattern and symbols.
|
* Creates a DecimalFormat using the given pattern and symbols.
|
||||||
* Use this constructor when you need to completely customize the
|
* Use this constructor when you need to completely customize the
|
||||||
* behavior of the format.
|
* behavior of the format.
|
||||||
|
* The number of maximum integer digits is usually not derived from the pattern.
|
||||||
|
* See the note in the {@link ##patterns Patterns} section for more detail.
|
||||||
* <p>
|
* <p>
|
||||||
* To obtain standard formats for a given
|
* To obtain standard formats for a given
|
||||||
* locale, use the factory methods on NumberFormat such as
|
* locale, use the factory methods on NumberFormat such as
|
||||||
|
@ -3298,9 +3311,8 @@ public class DecimalFormat extends NumberFormat {
|
||||||
* These properties can also be changed individually through the
|
* These properties can also be changed individually through the
|
||||||
* various setter methods.
|
* various setter methods.
|
||||||
* <p>
|
* <p>
|
||||||
* There is no limit to integer digits set
|
* The number of maximum integer digits is usually not derived from the pattern.
|
||||||
* by this routine, since that is the typical end-user desire;
|
* See the note in the {@link ##patterns Patterns} section for more detail.
|
||||||
* use setMaximumInteger if you want to set a real value.
|
|
||||||
* For negative numbers, use a second pattern, separated by a semicolon
|
* For negative numbers, use a second pattern, separated by a semicolon
|
||||||
* <P>Example {@code "#,#00.0#"} → 1,234.56
|
* <P>Example {@code "#,#00.0#"} → 1,234.56
|
||||||
* <P>This means a minimum of 2 integer digits, 1 fraction digit, and
|
* <P>This means a minimum of 2 integer digits, 1 fraction digit, and
|
||||||
|
@ -3325,9 +3337,8 @@ public class DecimalFormat extends NumberFormat {
|
||||||
* These properties can also be changed individually through the
|
* These properties can also be changed individually through the
|
||||||
* various setter methods.
|
* various setter methods.
|
||||||
* <p>
|
* <p>
|
||||||
* There is no limit to integer digits set
|
* The number of maximum integer digits is usually not derived from the pattern.
|
||||||
* by this routine, since that is the typical end-user desire;
|
* See the note in the {@link ##patterns Patterns} section for more detail.
|
||||||
* use setMaximumInteger if you want to set a real value.
|
|
||||||
* For negative numbers, use a second pattern, separated by a semicolon
|
* For negative numbers, use a second pattern, separated by a semicolon
|
||||||
* <P>Example {@code "#,#00.0#"} → 1,234.56
|
* <P>Example {@code "#,#00.0#"} → 1,234.56
|
||||||
* <P>This means a minimum of 2 integer digits, 1 fraction digit, and
|
* <P>This means a minimum of 2 integer digits, 1 fraction digit, and
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue