totn C Functions

C Language: strcspn function
(Search String for Intial Span of Characters Not in Set)

In the C Programming Language, the strcspn function searches within the string pointed to by 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 function 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 function returns the index of the first character 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 function can be used in the following versions:

  • ANSI/ISO 9899-1990

See Also

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