C programming string.h function - size_t strspn(const char *str1, const char *str2)

The strspn() function is a function from the C standard library header file string.h.

It returns the length of the initial segment of the string pointed to by the first argument that consists entirely of characters from the string pointed to by the second argument.

The syntax of the function is:

refer t‮o‬:theitroad.com
size_t strspn(const char *str1, const char *str2);

where str1 is the string to be searched, and str2 is the set of characters to search for.

The function returns the length of the initial segment of str1 that consists entirely of characters from str2. If no characters from str2 are found in str1, the function returns 0.