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

void SearchIterator::getMatchedText ( UnicodeString result  )  const [inherited]

Returns the text that was matched by the most recent call to first, next, previous, or last. If the iterator is not pointing at a valid match (e.g. just after construction or after USEARCH_DONE has been returned, returns an empty string.

Parameters:
result stores the matched string or an empty string if a match is not found.
See also:
first

next

previous

last ICU 2.0

Definition at line 110 of file search.cpp.

References SearchIterator::m_search_, UnicodeString::remove(), UnicodeString::setTo(), and USEARCH_DONE.

{
    int32_t matchedindex  = m_search_->matchedIndex;
    int32_t     matchedlength = m_search_->matchedLength;
    if (matchedindex != USEARCH_DONE && matchedlength != 0) {
        result.setTo(m_search_->text + matchedindex, matchedlength); 
    }
    else {
        result.remove();
    }
}


Generated by  Doxygen 1.6.0   Back to index