The search does not include the terminating null-characters.
Parameters
- str1
- C string to be scanned.
- str2
- C string containing the characters to match.
Return Value
A pointer to the first occurrence in str1 of any of the characters that are part of str2, or a null pointer if none of the characters of str2 is found in str1 before the terminating null-character.If none of the characters of str2 is present in str1, a null pointer is returned.
Portability
In C, this function is declared as:char * strpbrk ( const char *, const char * );
instead of the two overloaded versions provided in C++.
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
Output:
Vowels in 'This is a sample string': i i a a e i |
See also
| strcspn | Get span until character in string (function) |
| strchr | Locate first occurrence of character in string (function) |
| strrchr | Locate last occurrence of character in string (function) |
| memchr | Locate character in block of memory (function) |
