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