VMS Help  —  CRTL  strcspn
    Returns the length of the prefix of a string that consists
    entirely of characters not in a specified set of characters.

    Format

      #include  <string.h>

      size_t strcspn  (const char *str, const char *charset);

1  –  Arguments

 str

    A pointer to a character string. If this character string is a
    null string, 0 is returned.

 charset

    A pointer to a character string containing the set of characters.

2  –  Description

    The strcspn function scans the characters in the string, stops
    when it encounters a character found in charset, and returns the
    length of the string's initial segment formed by characters not
    found in charset.

    If none of the characters match in the character strings pointed
    to by str and charset, strcspn returns the length of string.

3  –  Return Value

    x                  The length of the segment.
Close Help