C Programming/string.h/strspn

From Wikibooks, open books for an open world
Jump to navigation Jump to search

strspn() function is used to find out the length of substring or length of maximum initial segment of the string pointed to by one string, let's say s1 containing all characters from another string pointed to by another string say s2.While strscpn() is used to find out length of initial segment containing all elements not in the reject list.

Syntax[edit | edit source]

size_t strspn(const char *s, const char *accept);

size_t strcspn(const char *s, const char *reject);

Parameters[edit | edit source]

s1- It points to null-terminated string to be searched.

s2- It points to null-terminated set of characters.

Reference[edit | edit source]

ANSI/ISO 9899-1990. Linux programmer's manual.

See also[edit | edit source]

index(3), memchr(3), rindex(3), strchr(3), string(3), strpbrk(3), strsep(3),strstr(3), strtok(3), wcscspn(3), wcsspn(3)