Find a prefix substring in a string consisting entirely of characters in a specified character set.
size_t strspn( LPCSTR lpcszString, LPCSTR lpcszCharSet )
Returns the index (based from 0) of the first character in a string that is not in a specified character set. All characters before returned index are in the character set.
EX1
void strspn_ex1() { char str1[] = "Mississippi"; out_int("", strspn( str1, "Mis" )); // The output is 8 out_int("", strspn( str1, "Misp" )); //The output is 11 out_int("", strspn( str1, "mIS" )); //The output is 0 }
strcspn
origin.h