CARM User's Guide

Discontinued

strcspn

Summary
#include <string.h>

int strcspn (
  const char *src,    /* source string */
  const char *set);   /* characters to find */
Description

The strcspn function searches the src string for any of the characters in the set string.

Return Value

The strcspn function returns the index of the first character located in src that matches a character in set. If the first character in src matches a character in set, a value of 0 is returned. If there are no matching characters in src, the length of the src is returned.

See Also

strchr, strpbrk, strpos, strrchr, strrpbrk, strrpos, strspn

Example
#include <string.h>
#include <stdio.h> /* for printf */

void tst_strcspn (void) {
  char buf [] = "13254.7980";
  int i;

  i = strcspn (buf, ".,");

  if (buf [i] != '\0')
    printf ("%c was found in %s\n",
            (char) buf [i],
            buf);
}