mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-14 01:11:02 +00:00
ICU-13442 Fixing checks for whether or not grouping is enabled. A grouping size of zero means that grouping is disabled.
X-SVN-Rev: 40677
This commit is contained in:
parent
254e5f9580
commit
3a1ee31d76
3 changed files with 4 additions and 3 deletions
|
@ -979,7 +979,7 @@ public class Parse {
|
|||
if (mode == null) mode = ParseMode.LENIENT;
|
||||
boolean integerOnly = properties.getParseIntegerOnly();
|
||||
boolean ignoreExponent = properties.getParseNoExponent();
|
||||
boolean ignoreGrouping = properties.getGroupingSize() < 0;
|
||||
boolean ignoreGrouping = properties.getGroupingSize() <= 0;
|
||||
|
||||
// Set up the initial state
|
||||
ParserState state = threadLocalParseState.get().clear();
|
||||
|
@ -1317,7 +1317,7 @@ public class Parse {
|
|||
numGroupingRegions--;
|
||||
}
|
||||
}
|
||||
if (grouping1 < 0) {
|
||||
if (grouping1 <= 0) {
|
||||
// OK (no grouping data available)
|
||||
} else if (numGroupingRegions <= 1) {
|
||||
// OK (no grouping digits)
|
||||
|
|
|
@ -1793,7 +1793,7 @@ public class DecimalFormat extends NumberFormat {
|
|||
*/
|
||||
@Override
|
||||
public synchronized boolean isGroupingUsed() {
|
||||
return properties.getGroupingSize() != -1 || properties.getSecondaryGroupingSize() != -1;
|
||||
return properties.getGroupingSize() > 0 || properties.getSecondaryGroupingSize() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -5325,6 +5325,7 @@ public class NumberFormatTest extends TestFmwk {
|
|||
DecimalFormat df = new DecimalFormat();
|
||||
df.setGroupingUsed(false);
|
||||
assertEquals("Grouping size should now be zero", 0, df.getGroupingSize());
|
||||
assertEquals("Grouping should be off", false, df.isGroupingUsed());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Reference in a new issue