#include <string.h> char *strpbrk(const char *str, const char *cset);
strpbrk
locates the first occurrence in the first argument string
(str
) of a character in the second argument string (cset
),
returning a pointer to the character found.
strpbrk
returns a pointer to the requested character, or NULL
if
no character in the string is in the requested set of characters.
strpbrk
is not properly terminated.
See the memscntb
function description for information on possible
interactions between the strpbrk
and memscntb
or
strscntb
functions.
#include <string.h> #include <stdio.h> main() { char *line, *white, *temp; char input[80]; puts("Enter some text:"); line = gets(input); /* Locate the first white-space character in */ /* the line. */ white = strpbrk(line, "ntrfv "); puts("The first white space occurs after the word: "); for(temp = line;temp <= white;temp++) putchar(*temp); putchar('n'); }
strchr
, strcspn
, strscan
, strtok
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.