@@ -236,6 +236,7 @@ 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" ;
239240
240241/* *
241242 * Maximum range for detecting daylight offset of a time zone when parsed time zone
@@ -1483,8 +1484,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
14831484 Calendar& cal,
14841485 UErrorCode& status) const
14851486{
1486- static const int32_t maxIntCount = 10 ;
1487- static const UnicodeString hebr (u" hebr" );
1487+ static constexpr int32_t maxIntCount = 10 ;
14881488
14891489 if (U_FAILURE (status)) {
14901490 return ;
@@ -1565,7 +1565,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
15651565// AD 12345 12345 45 12345 12345 12345
15661566 case UDAT_YEAR_FIELD:
15671567 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) {
1568+ if (fDateOverride == HEBREW_CALENDAR_VALUE && value>HEBREW_CAL_CUR_MILLENIUM_START_YEAR && value<HEBREW_CAL_CUR_MILLENIUM_END_YEAR) {
15691569 value-=HEBREW_CAL_CUR_MILLENIUM_START_YEAR;
15701570 }
15711571 if (count == 2 )
@@ -3055,7 +3055,6 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, ch
30553055 return -start;
30563056 }
30573057 UCalendarDateFields field = fgPatternIndexToCalendarField[patternCharIndex]; // UCAL_FIELD_COUNT if irrelevant
3058- UnicodeString hebr (" hebr" , 4 , US_INV);
30593058
30603059 if (numericLeapMonthFormatter != nullptr ) {
30613060 numericLeapMonthFormatter->setFormats (reinterpret_cast <const Format**>(¤tNumberFormat), 1 );
@@ -3223,7 +3222,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, ch
32233222 // we made adjustments to place the 2-digit year in the proper
32243223 // century, for parsed strings from "00" to "99". Any other string
32253224 // is treated literally: "2250", "-1", "1", "002".
3226- if (fDateOverride . compare (hebr)== 0 && value < 1000 ) {
3225+ if (fDateOverride == HEBREW_CALENDAR_VALUE && value < 1000 ) {
32273226 value += HEBREW_CAL_CUR_MILLENIUM_START_YEAR;
32283227 } else if (text.moveIndex32 (start, 2 ) == pos.getIndex () && !isChineseCalendar
32293228 && u_isdigit (text.char32At (start))
@@ -3263,7 +3262,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, ch
32633262
32643263 case UDAT_YEAR_WOY_FIELD:
32653264 // Comment is the same as for UDAT_Year_FIELDs - look above
3266- if (fDateOverride . compare (hebr)== 0 && value < 1000 ) {
3265+ if (fDateOverride == HEBREW_CALENDAR_VALUE && value < 1000 ) {
32673266 value += HEBREW_CAL_CUR_MILLENIUM_START_YEAR;
32683267 } else if (text.moveIndex32 (start, 2 ) == pos.getIndex ()
32693268 && u_isdigit (text.char32At (start))
0 commit comments