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

U_STABLE int32_t U_EXPORT2 usearch_first ( UStringSearch strsrch,
UErrorCode status 
)

Returns the first index at which the string text matches the search pattern. The iterator is adjusted so that its current index (as returned by usearch_getOffset) is the match position if one was found. If a match is not found, USEARCH_DONE will be returned and the iterator will be adjusted to the index USEARCH_DONE.

Parameters:
strsrch search iterator data struct
status for errors if it occurs
Returns:
The character index of the first match, or USEARCH_DONE if there are no matches.
See also:
usearch_getOffset

USEARCH_DONE ICU 2.4

Definition at line 3100 of file usearch.cpp.

References TRUE, U_SUCCESS, and USEARCH_DONE.

{
    if (strsrch && U_SUCCESS(*status)) {
        strsrch->search->isForwardSearching = TRUE;
        usearch_setOffset(strsrch, 0, status);
        if (U_SUCCESS(*status)) {
            return usearch_next(strsrch, status);
        }
    }
    return USEARCH_DONE;
}


Generated by  Doxygen 1.6.0   Back to index