find one string inside another
#include <string.h> size_t strspn( const char *str, const char *charset ); size_t _fstrspn( const char __far *str, const char __far *charset );
The strspn() function computes the length of the initial segment of the string pointed to by str that consists of characters from the string pointed to by charset. The terminating null character is not considered to be part of charset.
The _fstrspn() function is a data-model-independent form of the strspn() function that accepts far pointer arguments. It is most useful in mixed memory model applications.
The length of the segment.
#include <stdio.h> #include <string.h> void main() { printf( "%d\n", strspn( "out to lunch", "aeiou" ) ); printf( "%d\n", strspn( "out to lunch", "xyz" ) ); }
produces the output:
2 0
Safety: | |
---|---|
Interrupt handler | Yes |
Signal handler | Yes |
Thread | Yes |