home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / c / string.arc / STRSPN.C < prev    next >
C/C++ Source or Header  |  1984-12-31  |  768b  |  25 lines

  1. /*  File   : strspn.c
  2.     Author : Richard A. O'Keefe.
  3.     Updated: 11 April 1984
  4.     Defines: strspn()
  5.  
  6.     strspn(s1, s2) returns the  length  of  the  longest  prefix  of  s1
  7.     consisting  entirely  of characters in s2.  NUL is not considered to
  8.     be in s2, and _str2set will not include it in the set.
  9. */
  10.  
  11. #include "strings.h"
  12. #include "_str2set.h"
  13.  
  14. int strspn(str, set)
  15.     register _char_ *str;
  16.     char *set;
  17.     {
  18.     register int L;
  19.  
  20.     _str2set(set);
  21.     for (L = 0; _set_vec[*str++] == _set_ctr; L++) ;
  22.     return L;
  23.     }
  24.