Guardian C Library Calls Reference Manual
strpbrk
3-206 128833—Guardian TNS C Library Calls Reference Manual
Reference to Library Calls
strpbrk
The strpbrk function scans a string to find the first occurrence of a character from
another string.
str1_ptr
points to the string to scan.
str2_ptr
points to the string containing the characters to scan for.
Return Value
points to the first occurrence in *str1_ptr of any character in *str2_ptr. If *str1_ptr
does not contain any of the characters in *str2_ptr, then strpbrk returns the pointer
value NULL.
Example
This example scans string s, finds the first common character (-) and prints “-555-1212”:
#include <stringh>
#include <stdioh>
int main(void)
{
char *p;
char *s;
char *b;
s = "800-555-1212";
b = " -"; /* break chars are ' ' and '-' */
p = strpbrk(s,b);
printf("%s",p);
}
#include <stringh>
char *strpbrk(const char *str1_ptr, const char *str2_ptr);