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

U_STABLE UChar* U_EXPORT2 u_memchr ( const UChar *  s,
UChar  c,
int32_t  count 

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

s The string to search (contains count UChars).
c The BMP code point to find.
count The length of the string.
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 237 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_strFindFirst(s, count, &c, 1);
    } else {
        /* trivial search for a BMP code point */
        const UChar *limit=s+count;
        do {
            if(*s==c) {
                return (UChar *)s;
        } while(++s!=limit);
        return NULL;

Generated by  Doxygen 1.6.0   Back to index