 | C251 User's Guide |  |
|
|
| strspn| Summary | | | 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 (char *digit_str) {
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]);
}
|
|
|