strspn

Searches for a character string comprising only characters in a specified character set

#include <strings.h>
size_t strspn (
        const char *s1,
        const char *s2
)

Arguments

s1 Pointer to target character string to be searched
s2 Pointer to string containing the character set

Return Value

The length of the segment within the string pointed to by s1 that contains only characters from the string pointed to by s2 is returned.

Explanation

The character string starting from the beginning of the string pointed to by s1 that contains only characters from the string pointed to by s2 is located and its length is returned.