⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tst_strspn.c

📁 这是《Keil Cx51 V7.0单片机高级语言编程与uVision2应用实践》教材各章中列出的全部程序例子。
💻 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 + -