strpbrk

Locates the first occurrence in one string of any character from another string

Local Servers:nonblocking
Remote Servers:N/A
Classification:ANSI
MP Safe:Yes
Service:String Manipulation

Syntax

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

Parameters

str
(IN) Point to the string for which to locate the first occurrence of any character from the string pointed to by charset.
charset
(IN) Points to the string containing the characters to be located in the string pointed to by str.

Return Values

The strpbrk function returns a pointer to the located character or NULL if no character from charset occurs in str.

Remarks

The strpbrk function locates the first occurrence in the string pointed to by str of any character from the string pointed to by charset.

See Also

strchr, strcspn, strrchr, strtok

Example

  #include  <string.h>  
   
  main ()  
  {  
     char *p;  
     p = "Find all vowels";  
     while (p != NULL)  
     {  
        printf ("%s\n", p);  
        p = strpbrk (p+1, "aeiouAEIOU");  
     }  
  }
  

produces the following:

   Find all vowels  
   ind all vowels  
   all vowels  
   owels  
   els