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

U_STABLE UChar* U_EXPORT2 u_memrchr ( const UChar *  s,
UChar  c,
int32_t  count 
)

Find the last occurrence of a BMP code point in a string. A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NUL character is found at the string terminator.

Parameters:
s The string to search (contains count UChars).
c The BMP code point to find.
count The length of the string.
Returns:
A pointer to the last occurrence of c in s or NULL if c is not in s. ICU 2.4
See also:
u_strrchr

u_memrchr32

u_strFindLast

Definition at line 412 of file ustring.c.

References NULL, and U16_IS_SURROGATE.

                                                  {
    if(count<=0) {
        return NULL; /* no string */
    } else if(U16_IS_SURROGATE(c)) {
        /* make sure to not find half of a surrogate pair */
        return u_strFindLast(s, count, &c, 1);
    } else {
        /* trivial search for a BMP code point */
        const UChar *limit=s+count;
        do {
            if(*(--limit)==c) {
                return (UChar *)limit;
            }
        } while(s!=limit);
        return NULL;
    }
}


Generated by  Doxygen 1.6.0   Back to index