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);
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster