
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>strpbrk() scan string for character from character set</b>
[<<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);
const char *string1; Source string
const 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 in 'string1' 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";
char charset[6] = "aeiou";
char *rslt;
main()
{
if ((rslt = strpbrk(string,charset)) != NULL)
printf("vowel found: %c \n",*rslt);
}
See Also: strcspn() strchr() strrchr()
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson