strspn [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Library Reference Manual
strspn
Returns the length of the first substring in s1 composed entirely of
members of the character set s2.
Syntax
#include <string.h>
size_t strspn(const char *s1, const char *s2);
Parameters
s1 A pointer to a null-terminated character string to be
searched.
s2 A pointer to a null-terminated character string containing
a character set.
Return Values
x The length of the initial segment in s1 formed by
characters found in the s2 character set.
Description
The strspn 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 found, a counter is incremented and the
process continues. If a match is not found, this function ends,
returning the value of the counter.
Example
Given the following two strings:
"A tattletale never wins."
for string s1, and
" -Aatle"
for s2. Executing
strspn(s1, s2);
with the strings shown returns a value of 13, because the first 13
characters in s1 all occur in s2 "A tattletale ".
See Also
strcspn(), ANSI C 4.11.5.6, POSIX.1 8.1
MPE/iX 5.0 Documentation