size_t strspn

size_t strspn(const char *__s, const char *__accept) __ATTR_PURE__

The strspn() function calculates the length of the initial segment of s which consists entirely of characters in accept.

Remember:

The strspn() function returns the number of characters in the initial segment of s which consist only of characters from accept. The terminating zero is not considered as a part of string.