home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
d
/
dec92.zip
/
1012018A
< prev
next >
Wrap
Text File
|
1992-10-06
|
381b
|
17 lines
/* strspn function */
#include <string.h>
size_t (strspn)(const char *s1, const char *s2)
{ /* find index of first s1[i] that matches no s2[] */
const char *sc1, *sc2;
for (sc1 = s1; *sc1 != '\0'; ++sc1)
for (sc2 = s2; ; ++sc2)
if (*sc2 == '\0')
return (sc1 - s1);
else if (*sc1 == *sc2)
break;
return (sc1 - s1); /* null doesn't match */
}