tst_strspn.c
来自「这是《Keil Cx51 V7.0单片机高级语言编程与uVision2应用实践》」· C语言 代码 · 共 40 行
C
40 行
#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]);
}
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);
}
void tst_strpbrk (void) {
char vowels [] ="AEIOUaeiou";
char text [] = "Seven years ago...";
char * p;
p = strpbrk (text, vowels);
if (p == NULL)
printf ("No vowels found in %s\n", text);
else
printf ("Found a vowel at %s\n", p);
}
void tst_strrpbrk (void) {
char vowels [] ="AEIOUaeiou";
char text [] = "American National Standards Institute";
char * p;
p = strpbrk (text, vowels);
if (p == NULL)
printf ("No vowels found in %s\n", text);
else
printf ("Last vowel is at %s\n", p);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?