@@ -236,6 +236,8 @@ static const int32_t gFieldRangeBias[] = {
236236// offset the years within the current millennium down to 1-999
237237static const int32_t HEBREW_CAL_CUR_MILLENIUM_START_YEAR = 5000 ;
238238static const int32_t HEBREW_CAL_CUR_MILLENIUM_END_YEAR = 6000 ;
239+ static constexpr const char16_t HEBREW_CALENDAR_VALUE[] = u" hebr" ;
240+ static constexpr auto HEBREW_CALENDAR_VALUE_LEN = 4 ;
239241
240242/* *
241243 * Maximum range for detecting daylight offset of a time zone when parsed time zone
@@ -1483,8 +1485,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
14831485 Calendar& cal,
14841486 UErrorCode& status) const
14851487{
1486- static const int32_t maxIntCount = 10 ;
1487- static const UnicodeString hebr (u" hebr" );
1488+ static constexpr int32_t maxIntCount = 10 ;
14881489
14891490 if (U_FAILURE (status)) {
14901491 return ;
@@ -1565,7 +1566,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
15651566// AD 12345 12345 45 12345 12345 12345
15661567 case UDAT_YEAR_FIELD:
15671568 case UDAT_YEAR_WOY_FIELD:
1568- if (fDateOverride .compare (hebr )==0 && value>HEBREW_CAL_CUR_MILLENIUM_START_YEAR && value<HEBREW_CAL_CUR_MILLENIUM_END_YEAR) {
1569+ if (fDateOverride .compare (HEBREW_CALENDAR_VALUE, HEBREW_CALENDAR_VALUE_LEN )==0 && value>HEBREW_CAL_CUR_MILLENIUM_START_YEAR && value<HEBREW_CAL_CUR_MILLENIUM_END_YEAR) {
15691570 value-=HEBREW_CAL_CUR_MILLENIUM_START_YEAR;
15701571 }
15711572 if (count == 2 )
@@ -3055,7 +3056,6 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, ch
30553056 return -start;
30563057 }
30573058 UCalendarDateFields field = fgPatternIndexToCalendarField[patternCharIndex]; // UCAL_FIELD_COUNT if irrelevant
3058- UnicodeString hebr (" hebr" , 4 , US_INV);
30593059
30603060 if (numericLeapMonthFormatter != nullptr ) {
30613061 numericLeapMonthFormatter->setFormats (reinterpret_cast <const Format**>(¤tNumberFormat), 1 );
@@ -3223,7 +3223,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, ch
32233223 // we made adjustments to place the 2-digit year in the proper
32243224 // century, for parsed strings from "00" to "99". Any other string
32253225 // is treated literally: "2250", "-1", "1", "002".
3226- if (fDateOverride .compare (hebr )==0 && value < 1000 ) {
3226+ if (fDateOverride .compare (HEBREW_CALENDAR_VALUE, HEBREW_CALENDAR_VALUE_LEN )==0 && value < 1000 ) {
32273227 value += HEBREW_CAL_CUR_MILLENIUM_START_YEAR;
32283228 } else if (text.moveIndex32 (start, 2 ) == pos.getIndex () && !isChineseCalendar
32293229 && u_isdigit (text.char32At (start))
@@ -3263,7 +3263,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, ch
32633263
32643264 case UDAT_YEAR_WOY_FIELD:
32653265 // Comment is the same as for UDAT_Year_FIELDs - look above
3266- if (fDateOverride .compare (hebr )==0 && value < 1000 ) {
3266+ if (fDateOverride .compare (HEBREW_CALENDAR_VALUE, HEBREW_CALENDAR_VALUE_LEN )==0 && value < 1000 ) {
32673267 value += HEBREW_CAL_CUR_MILLENIUM_START_YEAR;
32683268 } else if (text.moveIndex32 (start, 2 ) == pos.getIndex ()
32693269 && u_isdigit (text.char32At (start))
0 commit comments