strspn(3) — Subroutines
NAME
strcspn, strspn - Returns length of initial segment of string
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <string.h> size_t strcspn(
const char ∗s1,
const char ∗s2); size_t strspn(
const char ∗s1,
const char ∗s2);
PARAMETERS
s1Points to a character string being checked for an initial segment.
s2Points to a string containing a set of bytes that define the initial segment.
DESCRIPTION
The strspn() function computes the length of the maximum initial segment of the string pointed to by the s1 parameter, which consists entirely of bytes from the string pointed to by the s2 parameter.
The strcspn() function computes the byte length of the maximum initial segment of the string pointed to by the s1 parameter, which consists entirely of bytes that are not from the string pointed to by the s2 parameter.
The strspn() and strcspn() functions treat the s2 parameter as a series of bytes; these functions do not treat a multibyte character as a single unit but rather as a series of separate bytes. There are no equivalent functions for multibyte character strings. The wcsspn() and wcscspn() functions provide the same functionality for wide character strings.
NOTES
AES Support Level:
Full use.
RETURN VALUES
Upon successful completion, the strcspn(), and strspn() functions return the length of the string segment. Otherwise, a value of -1 cast to size_t is returned.
RELATED INFORMATION
Functions: string(3), wcsspn(3)/wcscspn(3).