Keil Logo


#include <string.h>

int strspn (
  const unsigned char *string,   /* string to search */
  const unsigned char *set);     /* characters to allow */

The strspn function searches string for characters not found in the set string.

Return Value

The strspn function returns the index of the first character located in string that does not match a character in set. If the first character in string does not match a character in set, a value of 0 is returned. If all characters in string are found in set, the length of string is returned.

See Also

strchr, strcspn, strpbrk, strpos, strrchr, strrpbrk, strrpos

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

void tst_strspn (unsigned char *digit_str) {
  unsigned char octd [] = "01234567";
  int i;

  i = strspn (digit_str, octd);

  if (digit_str [i] != '\0')
    printf ("%c is not an octal digit\n", digit_str [i]);
  Arm logo
Important information


Change Settings

Privacy Policy Update

of your data.