Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/strspn.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/strspn.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/strspn.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/strspn.html on line 8
Count the characters at the beginning of a string that are in a given character set
#include <string.h>
size_t strspn( const char* str,
const char* charset );
- str
- The string that you want to search.
- charset
- The set of characters you want to look for.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The strspn() function computes
the length of the initial segment of the string pointed to by
str that consists of characters from the string pointed to by
charset.
The terminating null character isn't considered to be
part of charset.
The length of the segment.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main( void )
{
printf( "%d\n", strspn( "out to lunch", "aeiou" ) );
printf( "%d\n", strspn( "out to lunch", "xyz" ) );
return EXIT_SUCCESS;
}
produces the output:
2
0
ANSI,
POSIX 1003.1
Safety: | |
Cancellation point |
No |
Interrupt handler |
Yes |
Signal handler |
Yes |
Thread |
Yes |
memchr(),
strchr(),
strcspn(),
strpbrk(),
strrchr(),
strstr(),
strtok(),
strtok_r(),
wcschr(),
wcscspn(),
wcspbrk(),
wcsrchr(),
wcsspn(),
wcsstr(),
wcstok()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/strspn.html on line 152
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/strspn.html on line 152