Logo Search packages:      
Sourcecode: icu version File versions  Download package

void DateIntervalInfo::setFallbackIntervalPattern ( const UnicodeString fallbackPattern,
UErrorCode status 
)

Re-set the fallback interval pattern.

In construction, default fallback pattern is set as "{0} - {1}". And constructor taking locale as parameter will set the fallback pattern as what defined in the locale resource file.

This method provides a way for user to replace the fallback pattern.

Parameters:
fallbackPattern fall-back interval pattern.
status output param set to success/failure code on exit ICU 4.0

Definition at line 98 of file dtitvinf.cpp.

References UnicodeString::indexOf(), U_FAILURE, and U_ILLEGAL_ARGUMENT_ERROR.

Referenced by DateIntervalFormatTest::expectUserDII(), initializeData(), and DateIntervalFormatTest::stress().

                                                        {
    if ( U_FAILURE(status) ) {
        return;
    }
    int32_t firstPatternIndex = fallbackPattern.indexOf(gFirstPattern, 
                        sizeof(gFirstPattern)/sizeof(gFirstPattern[0]), 0);
    int32_t secondPatternIndex = fallbackPattern.indexOf(gSecondPattern, 
                        sizeof(gSecondPattern)/sizeof(gSecondPattern[0]), 0);
    if ( firstPatternIndex == -1 || secondPatternIndex == -1 ) {
        status = U_ILLEGAL_ARGUMENT_ERROR;
        return;
    }
    if ( firstPatternIndex > secondPatternIndex ) { 
        fFirstDateInPtnIsLaterDate = true;
    }
    fFallbackIntervalPattern = fallbackPattern;
}


Generated by  Doxygen 1.6.0   Back to index