

strpbrk()                String Function                strpbrk()




Find first occurrence of a character from another string

#include <string.h>
cchhaarr *ssttrrppbbrrkk(_s_t_r_i_n_g_1, _s_t_r_i_n_g_2);
cchhaarr *_s_t_r_i_n_g_1, *_s_t_r_i_n_g_2;

strpbrk returns a pointer  to the first character in string1 that
matches any character in  string2.  It returns NULL if no charac-
ter in string1 matches a character in string2.

The set of characters  that string2 points to is sometimes called
the ``break string''.  For example,


        char *string = "To be, or not to be: that is the question.";
        char *brkset = ",;";
        strpbrk(string, brkset);


returns the  value of the pointer ssttrriinngg  plus five.  This points
to the comma, which is the first character in the area pointed to
by ssttrriinngg that matches any  character in the string pointed to by
bbrrkksseett.

***** See Also *****

string functions, string.h

***** Notes *****

strpbrk resembles  the function strtok in  functionality, but un-
like strtok, it preserves  the contents of the strings being com-
pared.   It also  resembles  the function  strchr,  but lets  you
search for any one of a  group of characters, rather than for one
character alone.





















COHERENT Lexicon                                           Page 1


