function
<cstring>
strpbrkconst char * strpbrk ( const char * str1, const char * str2 ); char * strpbrk ( char * str1, const char * str2 );
Locate characters in string
Returns a pointer to the first occurrence in str1 of any of the characters that are part of str2, or a null pointer if there are no matches.The search does not include the terminating null-characters of either strings, but ends there.
char * strpbrk ( const char *, const char * );
instead of the two overloaded versions provided in C++.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* strpbrk example */
#include <stdio.h>
#include <string.h>
int main ()
{
char str[] = "This is a sample string";
char key[] = "aeiou";
char * pch;
printf ("Vowels in '%s': ",str);
pch = strpbrk (str, key);
while (pch != NULL)
{
printf ("%c " , *pch);
pch = strpbrk (pch+1,key);
}
printf ("\n");
return 0;
}
Vowels in 'This is a sample string': i i a a e i
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4