strcspn function(Search String for Intial Span of Characters Not in Set) in C Language – example and detail

In the C Programming Language, the strcspn function searches inside the string pointed to by way of s1 for the string pointed to by s2. It returns the index of the first character that is in the set.

Syntax

The syntax for the strcspn characteristic in the C Language is:

size_t strcspn(const char *s1, const char *s2);

Parameters or Arguments

s1 A string to search within. s2 The string that you want to find.

Returns

The strcspn characteristic returns the index of the first persona that is in the set.

Required Header

In the C Language, the required header for the strcspn function is:

#include <string.h>

Applies To

In the C Language, the strcspn characteristic can be used in the following versions:

ANSI/ISO 9899-1990

See Also

Other C features that are noteworthy when dealing with the strcspn function:

strspn function <string.h>