home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / C / DLIBSSRC.ZIP / STRCSPN.C < prev    next >
Encoding:
C/C++ Source or Header  |  1987-06-14  |  450 b   |  18 lines

  1. int strcspn(string, set)
  2. register char *string;
  3. register char *set;
  4. /*
  5.  *    Return the length of the sub-string of <string> that consists
  6.  *    entirely of characters not found in <set>.  The terminating '\0'
  7.  *    in <set> is not considered part of the match set.  If the first
  8.  *    character if <string> is in <set>, 0 is returned.
  9.  */
  10. {
  11.     register int n = 0;
  12.     char *strchr();
  13.  
  14.     while(*string && !strchr(set, *string++))
  15.         ++n;
  16.     return(n);
  17. }
  18.