Mega Code Archive

 
Categories / C / String
 

Get length of substring composed of given characters

#include <stdio.h> #include <string.h> int main () {   int i;   char key[] = "890th";   char str[] = "1234567890";   i = strspn (key, str);      printf ("Length of initial number is %d\n", i);   return 0; }