Table of Contents        Previous topic       Next topic       

C COMPILER LIBRARY FUNCTION REFERENCE->Detailed Descriptions->strcspn()


#include <string.h>

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


string1String being scanned
string2Character set string


This function measures the number of characters in string1 preceding the first character which is also 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 not in string2.  It string1 begins with a character in string2 then zero is returned.