strcspn [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Library Reference Manual
strcspn
Returns the length of the first substring in s1 composed entirely of
non-members of the character set s2.
Syntax
#include <string.h>
size_t strcspn(const char *s1, const char *s2);
Parameters
s1 A pointer to a character string to search.
s2 A pointer to a character string defining the character set.
Return Values
x The length of the initial segment in s1 formed by
characters not in s2.
Description
The strcspn function sequentially processes each character in the array
referenced by s1. For each character in the array, it scans s2 looking
for a match. If a match is not found, a counter is incremented and the
function continues. If a match is found, the scanning stops.
Example
Given the following two strings:
"A tattletale never wins."
for string s1, and
" -Aatle"
for s2. Executing
strcspn(s1, s2);
returns 0, because there is no initial segment of s1 that contains
characters not found in s2.
See Also
strspn(), ANSI C 4.11.5.3, POSIX.1 8.1
MPE/iX 5.0 Documentation