strspn(3) CLIX strspn(3)
NAME
strspn - Finds the length of the first occurence of one given string of
characters in another
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <string.h>
size_t strspn(
char * string1 ,
char * string2 );
PARAMETERS
string1
A pointer to a character string
string2
A pointer to a character string
DESCRIPTION
The strspn() function computes the length of the maximum initial segment
of the string pointed to by the string1 parameter, which consists entirely
of characters from the string pointed to by the string2 parameter.
EXAMPLES
#include <stdio.h>
#include <string.h>
main()
{
size_t sub_len;
char *string1 = "a string";
char *vowels = "aeiou";
/* The sub_len will be 1 since the second character of string1 is a space ' ' */
sub_len = strspn (string1, vowels);
printf ("The length of the initial segment of '%s" which consists\n", string1);
printf ("entirely of characters from '%s' is %d\n", vowels, sub_len);
}
RELATED INFORMATION
2/94 - Intergraph Corporation 1
strspn(3) CLIX strspn(3)
Functions: index(3), rindex(3), strcat(3), strcmp(3), strcspn(3),
strchr(3), strcpy(3), strlen(3), strncat(3), strncmp(3), strncpy(3),
strpbrk(3), strrchr(3)
2 Intergraph Corporation - 2/94