diff --git a/icu4c/source/i18n/nfrs.cpp b/icu4c/source/i18n/nfrs.cpp
index be2ab2932e7a..b7ffb561461b 100644
--- a/icu4c/source/i18n/nfrs.cpp
+++ b/icu4c/source/i18n/nfrs.cpp
@@ -152,7 +152,7 @@ NFRuleSet::NFRuleSet(RuleBasedNumberFormat *_owner, UnicodeString* descriptions,
UnicodeString& description = descriptions[index]; // !!! make sure index is valid
- if (description.length() == 0) {
+ if (description.isEmpty()) {
// throw new IllegalArgumentException("Empty rule set description");
status = U_PARSE_ERROR;
return;
@@ -177,16 +177,16 @@ NFRuleSet::NFRuleSet(RuleBasedNumberFormat *_owner, UnicodeString* descriptions,
name.setTo(UNICODE_STRING_SIMPLE("%default"));
}
- if (description.length() == 0) {
+ if (description.isEmpty()) {
// throw new IllegalArgumentException("Empty rule set description");
status = U_PARSE_ERROR;
}
fIsPublic = name.indexOf(gPercentPercent, 2, 0) != 0;
- if ( name.endsWith(gNoparse,8) ) {
+ if (name.endsWith(gNoparse, 8)) {
fIsParseable = false;
- name.truncate(name.length()-8); // remove the @noparse from the name
+ name.truncate(name.length() - 8); // remove the @noparse from the name
}
// all of the other members of NFRuleSet are initialized
diff --git a/icu4c/source/i18n/nfrule.cpp b/icu4c/source/i18n/nfrule.cpp
index a2400a6421bd..473873ce8764 100644
--- a/icu4c/source/i18n/nfrule.cpp
+++ b/icu4c/source/i18n/nfrule.cpp
@@ -64,6 +64,7 @@ NFRule::~NFRule()
static const char16_t gLeftBracket = 0x005b;
static const char16_t gRightBracket = 0x005d;
+static const char16_t gVerticalLine = 0x007C;
static const char16_t gColon = 0x003a;
static const char16_t gZero = 0x0030;
static const char16_t gNine = 0x0039;
@@ -146,6 +147,7 @@ NFRule::makeRules(UnicodeString& description,
// then it's really shorthand for two rules (with one exception)
LocalPointer
The resources contain three predefined formatters for each locale: spellout, which
* spells out a value in words (123 is "one hundred twenty-three"); ordinal, which
* appends an ordinal suffix to the end of a numeral (123 is "123rd"); and
* duration, which shows a duration in seconds as hours, minutes, and seconds (123 is
- * "2:03"). The client can also define more specialized RuleBasedNumberFormats
+ * "2:03"). The client can also define more specialized RuleBasedNumberFormat
s
* by supplying programmer-defined rule sets.
The behavior of a RuleBasedNumberFormat is specified by a textual description - * that is either passed to the constructor as a String or loaded from a resource + *
The behavior of a RuleBasedNumberFormat
is specified by a textual description
+ * that is either passed to the constructor as a String
or loaded from a resource
* bundle. In its simplest form, the description consists of a semicolon-delimited list of rules.
* Each rule has a string of output text and a value or range of values it is applicable to.
* In a typical spellout rule set, the first twenty rules are the words for the numbers from
@@ -116,7 +116,8 @@ enum URBNFRuleSetTag {
*
For larger numbers, we can use the preceding set of rules to format the ones place, and * we only have to supply the words for the multiples of 10:
* - *20: twenty[->>]; + *+ * 20: twenty[->>]; * 30: thirty[->>]; * 40: forty[->>]; * 50: fifty[->>]; @@ -137,7 +138,8 @@ enum URBNFRuleSetTag { *For even larger numbers, we can actually look up several parts of the number in the * list:
* - *100: << hundred[ >>];+ *+ * 100: << hundred[ >>];* *The "<<" represents a new kind of substitution. The << isolates * the hundreds digit (and any digits to its left), formats it using this same rule set, and @@ -155,13 +157,15 @@ enum URBNFRuleSetTag { * *
This rule covers values up to 999, at which point we add another rule:
* - *1000: << thousand[ >>];+ *+ * 1000: << thousand[ >>];* *Again, the meanings of the brackets and substitution tokens shift because the rule's * base value is a higher power of 10, changing the rule's divisor. This rule can actually be * used all the way up to 999,999. This allows us to finish out the rules as follows:
* - *1,000,000: << million[ >>]; + *+ * 1,000,000: << million[ >>]; * 1,000,000,000: << billion[ >>]; * 1,000,000,000,000: << trillion[ >>]; * 1,000,000,000,000,000: OUT OF RANGE!;@@ -177,30 +181,30 @@ enum URBNFRuleSetTag { *To see how these rules actually work in practice, consider the following example: * Formatting 25,430 with this rule set would work like this:
* - *
<< thousand >> | - *[the rule whose base value is 1,000 is applicable to 25,340] | + *<< thousand >> | + *[the rule whose base value is 1,000 is applicable to 25,340] | *
twenty->> thousand >> | - *[25,340 over 1,000 is 25. The rule for 20 applies.] | + *twenty->> thousand >> | + *[25,340 over 1,000 is 25. The rule for 20 applies.] | *
twenty-five thousand >> | - *[25 mod 10 is 5. The rule for 5 is "five." | + *twenty-five thousand >> | + *[25 mod 10 is 5. The rule for 5 is "five." | *
twenty-five thousand << hundred >> | - *[25,340 mod 1,000 is 340. The rule for 100 applies.] | + *twenty-five thousand << hundred >> | + *[25,340 mod 1,000 is 340. The rule for 100 applies.] | *
twenty-five thousand three hundred >> | - *[340 over 100 is 3. The rule for 3 is "three."] | + *twenty-five thousand three hundred >> | + *[340 over 100 is 3. The rule for 3 is "three."] | *
twenty-five thousand three hundred forty | - *[340 mod 100 is 40. The rule for 40 applies. Since 40 divides + * | twenty-five thousand three hundred forty | + *[340 mod 100 is 40. The rule for 40 applies. Since 40 divides * evenly by 10, the hyphen and substitution in the brackets are omitted.] | *
The description of a RuleBasedNumberFormat's behavior consists of one or more rule
+ * The description of a The user can also specify a special "rule set" named %%lenient-parse.
- * The body of %%lenient-parse isn't a set of number-formatting rules, but a RuleBasedCollator
+ * The user can also specify a special "rule set" named RuleBasedNumberFormat
's behavior consists of one or more rule
* sets. Each rule set consists of a name, a colon, and a list of rules. A rule
* set name must begin with a % sign. Rule sets with names that begin with a single % sign
* are public: the caller can specify that they be used to format and parse numbers.
* Rule sets with names that begin with %% are private: they exist only for the use
* of other rule sets. If a formatter only has one rule set, the name may be omitted.%%lenient-parse
.
+ * The body of %%lenient-parse
isn't a set of number-formatting rules, but a RuleBasedCollator
* description which is used to define equivalences for lenient parsing. For more information
- * on the syntax, see RuleBasedCollator. For more information on lenient parsing,
- * see setLenientParse(). Note: symbols that have syntactic meaning
+ * on the syntax, see RuleBasedCollator
. For more information on lenient parsing,
+ * see setLenientParse()
. Note: symbols that have syntactic meaning
* in collation rules, such as '&', have no particular meaning when appearing outside
- * of the lenient-parse rule set.lenient-parse
rule set.
The body of a rule set consists of an ordered, semicolon-delimited list of rules. * Internally, every rule has a base value, a divisor, rule text, and zero, one, or two substitutions. @@ -260,42 +264,46 @@ enum URBNFRuleSetTag { *
A rule descriptor can take one of the following forms (text in italics is the * name of a token):
* - *bv: | - *bv specifies the rule's base value. bv is a decimal + * | Descriptor | + *Description | + *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bv: | + *bv specifies the rule's base value. bv is a decimal * number expressed using ASCII digits. bv may contain spaces, period, and commas, * which are ignored. The rule's divisor is the highest power of 10 less than or equal to * the base value. | *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
bv/rad: | - *bv specifies the rule's base value. The rule's divisor is the + * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
bv/rad: | + *bv specifies the rule's base value. The rule's divisor is the * highest power of rad less than or equal to the base value. | *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
bv>: | - *bv specifies the rule's base value. To calculate the divisor, + * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
bv>: | + *bv specifies the rule's base value. To calculate the divisor, * let the radix be 10, and the exponent be the highest exponent of the radix that yields a * result less than or equal to the base value. Every > character after the base value * decreases the exponent by 1. If the exponent is positive or 0, the divisor is the radix * raised to the power of the exponent; otherwise, the divisor is 1. | *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
bv/rad>: | - *bv specifies the rule's base value. To calculate the divisor, + * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
bv/rad>: | + *bv specifies the rule's base value. To calculate the divisor, * let the radix be rad, and the exponent be the highest exponent of the radix that * yields a result less than or equal to the base value. Every > character after the radix * decreases the exponent by 1. If the exponent is positive or 0, the divisor is the radix * raised to the power of the exponent; otherwise, the divisor is 1. | *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-x: | - *The rule is a negative-number rule. | + *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-x: | + *The rule is a negative-number rule. | *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
x.x: | - *The rule is an improper fraction rule. If the full stop in + * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
x.x: | + *The rule is an improper fraction rule. If the full stop in * the middle of the rule name is replaced with the decimal point * that is used in the language or DecimalFormatSymbols, then that rule will * have precedence when formatting and parsing this rule. For example, some @@ -304,39 +312,39 @@ enum URBNFRuleSetTag { * handle the decimal point that matches the language's natural spelling of * the punctuation of either the full stop or comma. | *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
0.x: | - *The rule is a proper fraction rule. If the full stop in + * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
0.x: | + *The rule is a proper fraction rule. If the full stop in * the middle of the rule name is replaced with the decimal point * that is used in the language or DecimalFormatSymbols, then that rule will * have precedence when formatting and parsing this rule. For example, some * languages use the comma, and can thus be written as 0,x instead. For example, * you can use "0.x: point >>;0,x: comma >>;" to * handle the decimal point that matches the language's natural spelling of - * the punctuation of either the full stop or comma. | + * the punctuation of either the full stop or comma *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
x.0: | - *The rule is a default rule. If the full stop in + * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
x.0: | + *The rule is a default rule. If the full stop in * the middle of the rule name is replaced with the decimal point * that is used in the language or DecimalFormatSymbols, then that rule will * have precedence when formatting and parsing this rule. For example, some * languages use the comma, and can thus be written as x,0 instead. For example, * you can use "x.0: << point;x,0: << comma;" to * handle the decimal point that matches the language's natural spelling of - * the punctuation of either the full stop or comma. | + * the punctuation of either the full stop or comma *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Inf: | - *The rule for infinity. | + *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Inf: | + *The rule for infinity. | *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
NaN: | - *The rule for an IEEE 754 NaN (not a number). | + *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
NaN: | + *The rule for an IEEE 754 NaN (not a number). | *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
nothing | - *If the rule's rule descriptor is left out, the base value is one plus the + * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
nothing | + *If the rule's rule descriptor is left out, the base value is one plus the * preceding rule's base value (or zero if this is the first rule in the list) in a normal * rule set. In a fraction rule set, the base value is the same as the preceding rule's * base value. | @@ -352,8 +360,8 @@ enum URBNFRuleSetTag { * algorithms: If the rule set is a regular rule set, do the following: * *
>> | - *in normal rule | + *Syntax | + *Usage | + *Description | + *
---|---|---|---|---|
>> | + *in normal rule | *Divide the number by the rule's divisor and format the remainder | *||
- * | in negative-number rule | + *in negative-number rule | *Find the absolute value of the number and format the result | *|
- * | in fraction or default rule | + *in fraction or default rule | *Isolate the number's fractional part and format it. | *|
- * | in rule in fraction rule set | + *in rule in fraction rule set | *Not allowed. | *|
>>> | - *in normal rule | + *|||
>>> | + *in normal rule | *Divide the number by the rule's divisor and format the remainder, * but bypass the normal rule-selection process and just use the * rule that precedes this one in this rule list. | *||
- * | in all other rules | + *in all other rules | *Not allowed. | *|
<< | - *in normal rule | + *|||
<< | + *in normal rule | *Divide the number by the rule's divisor, perform floor() on the quotient,
* and format the resulting value. * If there is a DecimalFormat pattern between the < characters and the @@ -448,73 +457,67 @@ enum URBNFRuleSetTag { * |
* ||
- * | in negative-number rule | + *in negative-number rule | *Not allowed. | *|
- * | in fraction or default rule | + *in fraction or default rule | *Isolate the number's integral part and format it. | *|
- * | in rule in fraction rule set | + *in rule in fraction rule set | *Multiply the number by the rule's base value and format the result. | *|
== | - *in all rule sets | + *|||
== | + *in all rule sets | *Format the number unchanged | *||
[] | - *in normal rule | - *Omit the optional text if the number is an even multiple of the rule's divisor | + *||
[] | + *in normal rule | + *Omit the optional text and rules if the number is an even multiple of the rule's divisor. + * If the | symbol is present, the text and rules after the symbol and before the right bracket will be used instead of omission. | *||
- * | in negative-number rule | + *in negative-number rule | *Not allowed. | *|
- * | in improper-fraction rule | - *Omit the optional text if the number is between 0 and 1 (same as specifying both an - * x.x rule and a 0.x rule) | + *in improper-fraction rule | + *Omit the optional text and rules if the number is between 0 and 1 (same as specifying both an + * x.x rule and a 0.x rule). + * If the | symbol is present, the text and rules after the symbol and before the right bracket will be used instead of omission. | *
- * | in default rule | - *Omit the optional text if the number is an integer (same as specifying both an x.x - * rule and an x.0 rule) | + *in default rule | + *Omit the optional text and rules if the number is an integer (same as specifying both an x.x + * rule and an x.0 rule). + * If the | symbol is present, the text and rules after the symbol and before the right bracket will be used instead of omission. | *
- * | in proper-fraction rule | + *in proper-fraction rule | *Not allowed. | *|
- * | in rule in fraction rule set | - *Omit the optional text if multiplying the number by the rule's base value yields 1. | + *in rule in fraction rule set | + *Omit the optional text and rules if multiplying the number by the rule's base value yields 1. + * If the | symbol is present, the text and rules after the symbol and before the right bracket will be used instead of omission. | *
$(cardinal,plural syntax)$ | - *- * | in all rule sets | + *||
$(cardinal,plural syntax)$ | + *in all rule sets | *This provides the ability to choose a word based on the number divided by the radix to the power of the * exponent of the base value for the specified locale, which is normally equivalent to the << value. - * This uses the cardinal plural rules from PluralFormat. All strings used in the plural format are treated + * This uses the cardinal plural rules from {@link PluralFormat}. All strings used in the plural format are treated * as the same base value for parsing. | *||
$(ordinal,plural syntax)$ | - *- * | in all rule sets | + *||
$(ordinal,plural syntax)$ | + *in all rule sets | *This provides the ability to choose a word based on the number divided by the radix to the power of the * exponent of the base value for the specified locale, which is normally equivalent to the << value. - * This uses the ordinal plural rules from PluralFormat. All strings used in the plural format are treated + * This uses the ordinal plural rules from {@link PluralFormat}. All strings used in the plural format are treated * as the same base value for parsing. | *
The substitution descriptor (i.e., the text between the token characters) may take one * of three forms:
* - *Descriptor | + *Description | + *|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a rule set name | + *a rule set name | *Perform the mathematical operation on the number, and format the result using the * named rule set. | *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
a DecimalFormat pattern | + *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
a DecimalFormat pattern | *Perform the mathematical operation on the number, and format the result using a * DecimalFormat with the specified pattern. The pattern must begin with 0 or #. | *|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
nothing | + *||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
nothing | *Perform the mathematical operation on the number, and format the result using the rule
- * set containing the current rule, except:
- *
A class that formats numbers according to a set of rules. This number formatter is + * The RuleBasedNumberFormat class formats numbers according to a set of rules. This number formatter is * typically used for spelling out numeric values in words (e.g., 25,3476 as * "twenty-five thousand three hundred seventy-six" or "vingt-cinq mille trois * cents soixante-seize" or - * "funfundzwanzigtausenddreihundertsechsundsiebzig"), but can also be used for + * "fünfundzwanzigtausenddreihundertsechsundsiebzig"), but can also be used for * other complicated formatting tasks, such as formatting a number of seconds as hours, * minutes and seconds (e.g., 3,730 as "1:02:10"). * @@ -44,11 +44,11 @@ * spells out a value in words (123 is "one hundred twenty-three"); ordinal, which * appends an ordinal suffix to the end of a numeral (123 is "123rd"); and * duration, which shows a duration in seconds as hours, minutes, and seconds (123 is - * "2:03"). The client can also define more specialized RuleBasedNumberFormats + * "2:03"). The client can also define more specializedRuleBasedNumberFormat s
* by supplying programmer-defined rule sets.
*
- * The behavior of a RuleBasedNumberFormat is specified by a textual description - * that is either passed to the constructor as a String or loaded from a resource + * The behavior of a For larger numbers, we can use the preceding set of rules to format the ones place, and * we only have to supply the words for the multiples of 10: * - *20: twenty[->>]; - * 30: thirty{->>]; + *+ * 20: twenty[->>]; + * 30: thirty[->>]; * 40: forty[->>]; * 50: fifty[->>]; * 60: sixty[->>]; @@ -81,7 +82,8 @@ *
|