Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

strcspn - get length of complementary substring

&pagelevel(4)&pagelevel

Syntax

#include <string.h>

size_t strcspn(const char *s1, const char *s2);

Description

Starting at the beginning of string s1, strcspn() calculates the length of the segment that
does not contain a single character from string s2. The terminating null byte (\0) is not
treated as part of string s2.
The function is terminated and the segment length is returned on encountering a character
in s1 that matches a character in s2.
If the first character in s1 already matches a character in s2, the segment length is equal to 0.

Return val.

Integer value that indicates the segment length (number of non-matching characters) as of
the beginning of string s1.

Notes

See also

Strings terminated with the null byte (\0) are expected as arguments.

strspn(), string.h.