COHERENT manpages

This page displays the COHERENT manpage for strpbrk() [Find first occurrence of a character from another string].

List of available manpages
Index


strpbrk() -- String Function (libc)

Find first occurrence of a character from another string
#include <string.h>
char *strpbrk(string1, string2)
char *string1, *string2;

strpbrk() returns a pointer to  the first character in string1 that matches
any  character in  string2.  It returns  NULL  if no  character 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  string plus five.   This points  to the
comma, which is  the first character in the area  pointed to by string that
matches any character in the string pointed to by brkset.

See Also

libc,
string.h
ANSI Standard, §7.11.5.4
POSIX Standard, §8.1

Notes

strpbrk()  resembles the  function  strtok() in  functionality, but  unlike
strtok(), it preserves the contents of the strings being compared.  It also
resembles the function strchr(), but lets you search for any one of a group
of characters, rather than for one character alone.