break;
}
+ // Back up if there was a trailing grouping separator
+ if (backupOffset != -1) {
+ segment.setOffset(backupOffset);
+ hasPartialPrefix = true; // redundant with `groupingOverlap == segment.length()`
+ }
+
// Check the final grouping for validity
if (requireGroupingMatch
&& !seenDecimal
(34 25E-1) -342.5 K
(34,,25E-1) -342.5
// J doesn't allow trailing separators before E but C does
-(34,,25,E-1) -342.5 J
+(34,,25,E-1) -342.5 JP
(34 25 E-1) -342.5 JK
(34,,25 E-1) -342.5 CJK
// Spaces are not allowed after exponent symbol
// C parses until trailing separators, but sees -1234
1,234,,,+ 1234 JKC
1,234- -1234
-// J bails because of trailing separators
-1,234,- -1234 J
+// J and P bail because of trailing separators
+1,234,- -1234 JP
// J bails here too
1234 - -1234 J
expect2(df, 45, "USD 45.00");
expect2(df, -45, "-45.00 USD");
}
+
+ @Test
+ public void test13684_FrenchPercentParsing() {
+ NumberFormat numberFormat = NumberFormat.getPercentInstance(ULocale.FRENCH);
+ numberFormat.setParseStrict(true);
+ ParsePosition ppos = new ParsePosition(0);
+ Number percentage = numberFormat.parse("8\u00A0%", ppos);
+ assertEquals("Should parse successfully", 0.08, percentage.doubleValue());
+ assertEquals("Should consume whole string", 3, ppos.getIndex());
+ }
}