@@ -1483,8 +1483,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
14831483 Calendar& cal,
14841484 UErrorCode& status) const
14851485{
1486- static const int32_t maxIntCount = 10 ;
1487- static const UnicodeString hebr (u" hebr" );
1486+ static constexpr int32_t maxIntCount = 10 ;
14881487
14891488 if (U_FAILURE (status)) {
14901489 return ;
@@ -1565,7 +1564,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
15651564// AD 12345 12345 45 12345 12345 12345
15661565 case UDAT_YEAR_FIELD:
15671566 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) {
1567+ if (fDateOverride .compare (UnicodeString ( u" hebr" , 4 ) )==0 && value>HEBREW_CAL_CUR_MILLENIUM_START_YEAR && value<HEBREW_CAL_CUR_MILLENIUM_END_YEAR) {
15691568 value-=HEBREW_CAL_CUR_MILLENIUM_START_YEAR;
15701569 }
15711570 if (count == 2 )
@@ -3055,7 +3054,6 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, ch
30553054 return -start;
30563055 }
30573056 UCalendarDateFields field = fgPatternIndexToCalendarField[patternCharIndex]; // UCAL_FIELD_COUNT if irrelevant
3058- UnicodeString hebr (" hebr" , 4 , US_INV);
30593057
30603058 if (numericLeapMonthFormatter != nullptr ) {
30613059 numericLeapMonthFormatter->setFormats (reinterpret_cast <const Format**>(¤tNumberFormat), 1 );
@@ -3223,7 +3221,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, ch
32233221 // we made adjustments to place the 2-digit year in the proper
32243222 // century, for parsed strings from "00" to "99". Any other string
32253223 // is treated literally: "2250", "-1", "1", "002".
3226- if (fDateOverride .compare (hebr)==0 && value < 1000 ) {
3224+ if (fDateOverride .compare (UnicodeString ( u" hebr" , 4 ) )==0 && value < 1000 ) {
32273225 value += HEBREW_CAL_CUR_MILLENIUM_START_YEAR;
32283226 } else if (text.moveIndex32 (start, 2 ) == pos.getIndex () && !isChineseCalendar
32293227 && u_isdigit (text.char32At (start))
@@ -3263,7 +3261,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, ch
32633261
32643262 case UDAT_YEAR_WOY_FIELD:
32653263 // Comment is the same as for UDAT_Year_FIELDs - look above
3266- if (fDateOverride .compare (hebr)==0 && value < 1000 ) {
3264+ if (fDateOverride .compare (UnicodeString ( u" hebr" , 4 ) )==0 && value < 1000 ) {
32673265 value += HEBREW_CAL_CUR_MILLENIUM_START_YEAR;
32683266 } else if (text.moveIndex32 (start, 2 ) == pos.getIndex ()
32693267 && u_isdigit (text.char32At (start))
0 commit comments