Name

strpbrk - search a string for any of a set of characters

Library

libc.lib

Synopsis

  #include <string.h>
  char * strpbrk (const char *s, const char *charset);

Detailed description

The strpbrk function locates in the null-terminated string s the first occurrence of any character in the string charset and returns a pointer to this character. If no characters from charset occur anywhere in s strpbrk returns NULL.

Examples

#include <string.h>
#include <stdio.h>
int main()
{
    char one[50];
    char *res;
    strcpy(one,"acdb");
    res = strpbrk(one, "bc");
    if(res != NULL)
       printf("%s\n",res);
    return 0;
}

         

Output

cdb

         

Return value

The strpbrk() function returns a pointer to the character in s that matches one of the characters in accept, or NULL if no such character is found.

See also

memchr, strchr, strcspn, strsep, strspn, strstr, strtok


Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top