strpbrk -- Find First Occurrence of Character of Set in String

SYNOPSIS

 #include <string.h>

 char *strpbrk(const char *str, const char *cset);
 

DESCRIPTION

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.

RETURN VALUE

strpbrk returns a pointer to the requested character, or NULL if no character in the string is in the requested set of characters.

CAUTION

A protection or addressing exception may occur if either argument to strpbrk is not properly terminated.

See the memscntb function description for information on possible interactions between the strpbrk and memscntb or strscntb functions.

EXAMPLE

  #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');
  }

 

RELATED FUNCTIONS

strchr, strcspn, strscan, strtok

SEE ALSO

String Utility Functions

Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.