strpbrk()

Look for the first occurrence of any one of an array of characters in another.

  #include <string.h>
  
  char *strpbrk(const char *s1, const char *s2);    
Parameter

s1

A pointer to the string to search.

s2

A pointer to a list of characters to search for.

Remarks

This function searches the character array pointed to by s1 for the first occurrence of a character in the character array pointed to by s2. Both s1 and s2 must point to null-terminated character arrays.

The function returns a pointer to the first character in s1 that matches any character in s2, and returns a null pointer ( NULL) if no match was found.

This facility may not be available on some configurations of the EWL.

Listing: Example of strpbrk usage

#include <string.h>

#include <stdio.h>

int main(void)

{

char s1[] = "orange banana pineapple *plum";

char s2[] = "*%#$";

puts(strpbrk(s1, s2));

return 0;

}

Output:

*plum