totn C Functions

C Language: strspn function
(Search String for Initial Span of Characters in Set)

In the C Programming Language, the strspn 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 not in the set.

Syntax

The syntax for the strspn function in the C Language is:

size_t strspn(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 strspn function returns the index of the first character that is not in the set.

Required Header

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

#include <string.h>

Applies To

In the C Language, the strspn function can be used in the following versions:

  • ANSI/ISO 9899-1990

See Also

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