看C++文档的小知识

转载:http://www.ggv.com.cn/forum/clib/ctype/isspace.html

函数isspace

 

原型:extern int isspace(int c);
 
  用法:#include <ctype.h>
 
  功能:判断字符c是否为空白符
 
  说明:当c为空白符时,返回非零值,否则返回零。
     空白符指空格、水平制表、垂直制表、换页、回车和换行符。
 
  举例:

      // isspace.c
     
      #include <syslib.h>
      #include <ctype.h>

      main()
      {
        char s[]="Test Line 1\tend\nTest Line 2\r";
        int i;
       
        clrscr();        // clear screen
        for(i=0;i<strlen(s);i++)
        {
          if(isspace(s[i])) putchar('.');
          else putchar(s[i]);
        }
        getchar();
        return 0;
      }

posted @ 2009-06-19 11:34  mogu  阅读(149)  评论(0编辑  收藏  举报