strcspn

 

Description

Find a substring in a string.

Syntax

size_t strcspn( LPCSTR lpcszString, LPCSTR lpcszCharSet )

Parameters

lpcszString
[input] String to search through
lpcszCharSet
[input] String containing specified character set

Return

Returns the index of the first occurrence of a character in string that is in strCharSet. All characters before returned index are not in character set.

Examples

EX1

void strcspn_ex1()
{
   char str[] = "xyzababc";
   int  pos;

   pos = strcspn( str, "abc" );
   printf( "First a, b or c in %s is at character %d\n", str, pos );

}

Remark

See Also

header to Include

origin.h

Reference