strpbrk
locate multiple characters in string
You're viewing an older version of this page (#3502). View the current version.
INTERFACE
#include <string.h> char strpbrk ( const char *s, const char *charset )
DESCRIPTION
The strpbrk function locates in the null-terminated string \c s the first occurrence of any character in the string \c charset and returns a pointer to this character. If no characters from \c charset occur anywhere in \c s strpbrk returns NULL.
Example 1
#include <stdio.h>
#include <string.h>
int main()
{
char s[20] = "abcde1010101", t[3] = "01";
printf("The position of the first binary digit of s is: %d.\n", strpbrk(s, t) - s);
return 0;
}Output:
The position of the first binary digit of s is: 5.SEE ALSO
memchr, strchr, strcspn, strrchr, strspn, strstr, strtok
STANDARDS
The strpbrk function conforms to ISO/IEC 9899:1990 ("ISO C90").