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

U_STABLE UChar* U_EXPORT2 u_strchr32 ( const UChar *  s,
UChar32  c 

Find the first 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.

s The string to search (NUL-terminated).
c The code point to find.
A pointer to the first occurrence of c in s or NULL if c is not in s. ICU 2.0
See also:




Definition at line 216 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_strchr(s, (UChar)c);
    } else if((uint32_t)c<=UCHAR_MAX_VALUE) {
        /* find supplementary code point as surrogate pair */
        UChar cs, lead=U16_LEAD(c), trail=U16_TRAIL(c);

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

Generated by  Doxygen 1.6.0   Back to index