Keil Logo

strspn

Summary
#include <string.h>

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

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

Example
#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

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.