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

U_STABLE UChar* U_EXPORT2 u_strrchr ( const UChar *  s,
UChar  c 
)

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 (NUL-terminated).
c The BMP code point to find.
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_strrchr32

u_memrchr

u_strrstr

u_strFindLast

Definition at line 368 of file ustring.c.

References NULL, and U16_IS_SURROGATE.

                                   {
    if(U16_IS_SURROGATE(c)) {
        /* make sure to not find half of a surrogate pair */
        return u_strFindLast(s, -1, &c, 1);
    } else {
        const UChar *result=NULL;
        UChar cs;

        /* trivial search for a BMP code point */
        for(;;) {
            if((cs=*s)==c) {
                result=s;
            }
            if(cs==0) {
                return (UChar *)result;
            }
            ++s;
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index