Code example for CharacterIterator

Methods: getBeginIndexgetEndIndexgetIndexsetIndex

0
     * @see #DONE 
     * @stable ICU 2.0 
     */ 
    public int previous() 
    { 
        int start = targetText.getIndex();
        if (m_setOffset_ != DONE) {
            start = m_setOffset_;    
            m_setOffset_ = DONE;    
        } 
        if (m_reset_) {
            m_isForwardSearching_ = false;
            m_reset_ = false;
            start = targetText.getEndIndex();
        } 
         
        if (m_isForwardSearching_ == true) {
            // switching direction.  
            // if matchedIndex == USEARCH_DONE, it means that either a  
            // setIndex has been called or that next ran off the text 
            // string. the iterator would have been set to offset textLength if  
            // a match is not found. 
            m_isForwardSearching_ = false;
            if (start != targetText.getEndIndex()) {
                return start;
            } 
        } 
        else { 
            if (start == targetText.getBeginIndex()) {
                // not enough characters to match 
                matchLength = 0;
                targetText.setIndex(targetText.getBeginIndex());
                m_lastMatchStart_ = DONE;
                return DONE; 
            } 
        } 
 
Connect your IDE to all the code out there  Get Codota for Java