Table of Contents        Previous topic       Next topic       

C LIBRARY FUNCTIONS->Detailed Descriptions->strspn()


#include <string.h>

size_t strspn(const char* string1,const char* string2);Measure span of characters in set


string1String being scanned
string2Character set string


This function measures the number of characters in string1 preceding the first character which is not in string2.  The null termination character is not included in the search.

Both string1 and string2 must be null terminated strings.

Return Value

The length of the initial sub-string in string1 that consists entirely of characters in string2.  It string1 begins with a character not in string2 then zero is returned.