strpbrk, _fstrpbrk
raw OCR
Scans a string for the first occurrence of any character from a given set.
Defined in header <string.h>
Syntax
#include <string.h>
Near version: char *strpbrk(const char *sl, const char *s2);
Far version: char far * far _fstrpbrk(const char far *sl,const char far *s2)
Portability
| DOS | UNIX | Windows | ANSI C | C++ only | |
|---|---|---|---|---|---|
| Near version | ■ | ■ | ■ | ■ | |
| ■ | ■ |
Remarks
strpbrk scans a string, si, for the first occurrence of any character appearing in s2.
Return value
strpbrk returns a pointer to the first occurrence of any of the characters in s2. If none of the s2 characters occurs in si, it returns null.
Example
#include <stdio.h>
#include <string.h>
int main(void)
{
char *stringl = "abcdefghijklmnopqrstuvwxyz";
char *string2 = "onm";
char *ptr;
ptr = strpbrk (stringl, string2);
if (ptr)
printf ("strpbrk found first character: %c\h", *ptr);
else
printf ("strpbrk didn't find character in set\n");
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/string.h/strpbrk/
· short form /3.1/strpbrk/