Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

strspn - get length of substring

&pagelevel(4)&pagelevel

Syntax

#include <string.h>

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

Description

Starting at the beginning of string s1, strspn() computes the length of the segment that contains only characters from string s2.
The function is terminated, and the segment length is returned on encountering the first character in s1 that does not match any character in s2.
If the first character in s1 matches none of the characters in s2, the segment length is equal to 0.

Return val.

Integer value

that indicates the segment length (number of matching characters), starting at the beginning of string s1.

Notes

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

See also

strcspn(), string.h.