case UDAT_FRACTIONAL_SECOND_FIELD:
// Fractional seconds left-justify
- i = pos.getIndex() - start;
+ i = countDigits(text, start, pos.getIndex());
if (i < 3) {
while (i < 3) {
value *= 10;
}
}
+int32_t SimpleDateFormat::countDigits(const UnicodeString& text, int32_t start, int32_t end) const {
+ int32_t numDigits = 0;
+ int32_t idx = start;
+ while (idx < end) {
+ UChar32 cp = text.char32At(idx);
+ if (u_isdigit(cp)) {
+ numDigits++;
+ }
+ idx += U16_LENGTH(cp);
+ }
+ return numDigits;
+}
+
//----------------------------------------------------------------------
void SimpleDateFormat::translatePattern(const UnicodeString& originalPattern,
int32_t checkIntSuffix(const UnicodeString& text, int32_t start,
int32_t patLoc, UBool isNegative) const;
+ /**
+ * Counts number of digit code points in the specified text.
+ *
+ * @param text input text
+ * @param start start index, inclusive
+ * @param end end index, exclusive
+ * @return number of digits found in the text in the specified range.
+ */
+ int32_t countDigits(const UnicodeString& text, int32_t start, int32_t end) const;
+
/**
* Translate a pattern, mapping each character in the from string to the
* corresponding character in the to string. Return an error if the original
logln(" Thread %d, Locale %s, Pattern %s",
threadNumber, gLocaleData->locales[locidx].getName(), CStr(pattern)());
- if (uprv_strcmp(gLocaleData->locales[locidx].getLanguage(), "ccp") == 0
- && logKnownIssue("13446", "Chakma time zone parsing")) {
- continue;
- }
-
SimpleDateFormat *sdf = new SimpleDateFormat(pattern, gLocaleData->locales[locidx], status);
if (U_FAILURE(status)) {
errcheckln(status, (UnicodeString) "new SimpleDateFormat failed for pattern " +