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

U_STABLE UChar* U_EXPORT2 u_strrchr32 ( const UChar *  s,
UChar32  c 
)

Find the last occurrence of a 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 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_strrchr

u_memchr32

u_strrstr

u_strFindLast

Definition at line 390 of file ustring.c.

References NULL, U16_LEAD, U16_TRAIL, and UCHAR_MAX_VALUE.

                                       {
    if((uint32_t)c<=U_BMP_MAX) {
        /* find BMP code point */
        return u_strrchr(s, (UChar)c);
    } else if((uint32_t)c<=UCHAR_MAX_VALUE) {
        /* find supplementary code point as surrogate pair */
        const UChar *result=NULL;
        UChar cs, lead=U16_LEAD(c), trail=U16_TRAIL(c);

        while((cs=*s++)!=0) {
            if(cs==lead && *s==trail) {
                result=s-1;
            }
        }
        return (UChar *)result;
    } else {
        /* not a Unicode code point, not findable */
        return NULL;
    }
}


Generated by  Doxygen 1.6.0   Back to index