zoukankan      html  css  js  c++  java
  • 判断是空白符(空格、换页、换行、回车、横向制表和纵向制表)的方法

    #include <stdio.h>
    #include <ctype.h>
    
    /*
    判断是空白(空格-ASCII 32,换页-12,换行-10,回车-13,横向制表-9,纵向制表-11)的库函数:
    满足指定的条件,返回非0;否则返回0.
    isspace(c)
    */
    
    /***************
     * 输入:要判断的字符。
     * 输出:是空白,返回1;其他,返回0.
     **************/
    int my_isspace(unsigned char c)
    {
    	if ((c >= 9 && c <= 13) || (c == 32) ) {
    		return 1;
    	}
    	return 0;
    }
    
    int main(void)
    {
    
    	printf("%d\n", my_isspace('\n'));
    	printf("%d\n", isspace('\n'));
    
    	printf("%d\n", my_isspace(' '));
    	printf("%d\n", isspace(' '));
    
    	printf("%d\n", my_isspace('5'));
    	printf("%d\n", isspace('5'));
    
    	return 0;
    }
  • 相关阅读:
    Python 递归
    Python 面向过程编程
    Python 协程函数
    Python-第三方库requests详解
    Python 三元表达式
    linux copy
    centos 安装软件
    mysql 权限
    mysql 权限 备份
    android 开发
  • 原文地址:https://www.cnblogs.com/helloweworld/p/2801932.html
Copyright © 2011-2022 走看看