Next: strerror, Previous: strcpy, Up: Strings [Contents][Index]

### 5.26 `strcspn`—count characters not in string

Synopsis

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

Description
This function computes the length of the initial part of the string pointed to by s1 which consists entirely of characters NOT from the string pointed to by s2 (excluding the terminating null character).

Returns
`strcspn` returns the length of the substring found.

Portability
`strcspn` is ANSI C.

`strcspn` requires no supporting OS subroutines.