[Previous]
[Contents]
[Next]

strspn(), _fstrspn()

find one string inside another

Synopsis:

#include <string.h>

size_t strspn( const char *str,
               const char *charset );
size_t _fstrspn( const char __far *str,
                 const char __far *charset );

Description:

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.

Returns:

The length of the segment.

Examples:

#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

Classification:

strspn() is ANSI; _fstrspn() is WATCOM.
Safety:
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

strcspn()


[Previous]
[Contents]
[Next]