[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
strpbrk() Scan String for Character from Character Set
#include <string.h> Required for declarations only
char *strpbrk(string1,charset);
char *string1; Source string
char *charset; Character set
strpbrk() scans 'string1' for the first occurrence of any character
from 'charset'. The terminating null character ('\0') is not
included in the search.
Returns: A pointer to the first occurrence of any of the
characters in 'charset'. If none of the characters in
'charset' occur in 'string' a NULL pointer is returned.
-------------------------------- Example ---------------------------------
The following statements scan 'string' for a vowel. If one is found,
a message, along with the vowel, is printed.
#include <string.h>
#include <stdio.h>
char string[20] = "straight";
charset[5] = "aeiou";
char *rslt;
main()
{
if ((rslt = strpbrk(string,charset)) != NULL)
printf("vowel found: %c \n",*rslt);
}
See Also:
strcspn()
strchr()
strrchr()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson