Name
strspn - search a string for a set of characters
Library
libc.lib
Synopsis
|
size_t
strspn (const char *s, const char *charset);
|
Return values
strspn
function returns the number of characters in the initial segment of s which consists only of characters from
accept
Detailed description
The
strspn
function
spans the initial part of the null-terminated string
s
as long as the characters from
s
occur in the null-terminated string
charset.
In other words, it computes the string array index in
s
of the first character of
s
which is not in
charset,
else the index of the first null character.
Examples
#include <string.h>
#include <stdio.h>
int main()
{
char one[50];
int res;
strcpy(one,"abcba");
res = strspn(one, "abc");
printf(" %d times characters found in the string \n",res);
return 0;
}
Output
5 times characters found in the string
Return values
The
strspn
function
returns the number of characters spanned.
See also
memchr,
strchr,
strpbrk,
strsep,
strstr,
strtok
Feedback
For additional information or queries on this page send feedback
© 2008 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user. |
|