Name
strcspn
- search a string for a set of characters
Library
libc.lib
Synopsis
|
size_t
strcspn (const char *s, const char *charset);
|
Return values
The
strcspn
function
returns the number of characters spanned.
Detailed description
The
strcspn
function
spans the initial part of the null-terminated string
s
as long as the characters from
s
do not occur in string
charset
(it
spans the
complement
of
charset).
In other words, it computes the string array index in
s
of the first character of
s
which is also in
charset,
else the index of the first null character.
Examples
#include <string.h>
#include <stdio.h>
int main()
{
printf("Number of characters present in s\n which are not in charset is %d",strcspn("abcde","df"));
return 0;
}
Output
Number of characters present in s
which are not in charset is 3
See also
memchr,
strchr,
strpbrk,
strrchr,
strsep,
strspn,
strstr,
strtok
Feedback
For additional information or queries on this page send feedback
© 2005-2007 Nokia
|
|