size_t strspn ( const char * str1, const char * str2 );
123456789101112131415
/* strspn example */ #include <stdio.h> #include <string.h> int main () { int i; char strtext[] = "129th"; char cset[] = "1234567890"; i = strspn (strtext,cset); printf ("The initial number has %d digits.\n",i); return 0; }
The initial number has 3 digits.