mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-14 17:24:01 +00:00
ICU-10880 Minor optimization and documentation fix
X-SVN-Rev: 36202
This commit is contained in:
parent
a7b3861443
commit
5c12dc4923
3 changed files with 10 additions and 6 deletions
|
@ -384,7 +384,7 @@ final class NFRule {
|
|||
int pluralRuleStart = ruleText.indexOf("$(");
|
||||
int pluralRuleEnd = (pluralRuleStart >= 0 ? ruleText.indexOf(')', pluralRuleStart) : -1);
|
||||
if (pluralRuleEnd >= 0) {
|
||||
int endType = ruleText.indexOf(',');
|
||||
int endType = ruleText.indexOf(',', pluralRuleStart);
|
||||
if (endType < 0) {
|
||||
throw new IllegalArgumentException("Rule \"" + ruleText + "\" does not have a defined type");
|
||||
}
|
||||
|
|
|
@ -755,7 +755,7 @@ public class PluralFormat extends UFormat {
|
|||
else {
|
||||
currMatchIndex = source.indexOf(currArg);
|
||||
}
|
||||
if (currMatchIndex > matchedIndex && (matchedWord == null || currArg.length() > matchedWord.length())) {
|
||||
if (currMatchIndex >= 0 && currMatchIndex >= matchedIndex && (matchedWord == null || currArg.length() > matchedWord.length())) {
|
||||
matchedIndex = currMatchIndex;
|
||||
matchedWord = currArg;
|
||||
keyword = pattern.substring(partStart.getLimit(), partLimit.getIndex());
|
||||
|
|
|
@ -437,15 +437,19 @@ import com.ibm.icu.util.UResourceBundleIterator;
|
|||
* <td width="37">$(cardinal,<i>plural syntax</i>)</td>
|
||||
* <td width="23"></td>
|
||||
* <td width="165" valign="top">in all rule sets</td>
|
||||
* <td>This provides the ability to choose a word based on the number divided by the base value for the specified locale.
|
||||
* This uses the cardinal plural rules from PluralFormat. All strings used in the plural format are treated as the same base value for parsing.</td>
|
||||
* <td>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
|
||||
* as the same base value for parsing.</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td width="37">$(ordinal,<i>plural syntax</i>)</td>
|
||||
* <td width="23"></td>
|
||||
* <td width="165" valign="top">in all rule sets</td>
|
||||
* <td>This provides the ability to choose a word based on the number divided by the base value for the specified locale.
|
||||
* This uses the ordinal plural rules from PluralFormat. All strings used in the plural format are treated as the same base value for parsing.</td>
|
||||
* <td>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
|
||||
* as the same base value for parsing.</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue