📄 tst_strspn.c
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -