C 标准库 - ctype.h

This header declares a set of functions to classify and transform individual characters.

  • These functions take the int equivalent of one character as parameter and return an int that can either be another character or a value representing a boolean value: an int value of 0 means false, and an int value different from 0 represents true.
  • C 标准库的 ctype.h 头文件提供了一些函数,可用于测试和映射字符。

    这些函数接受 int 作为参数,它的值必须是 EOF 或表示为一个无符号字符。

    如果参数 c 满足描述的条件,则这些函数返回非零(true)。如果参数 c 不满足描述的条件,则这些函数返回零。

函数


//Character classification functions
//They check whether the character passed as parameter belongs to a certain category:
int isalnum(int c)
检查所传的字符是否是字母和数字。 int isalpha(int c)
检查所传的字符是否是字母。 int isblank (int c)
Check if character is blank int iscntrl(int c)
检查所传的字符是否是控制字符。 int isdigit(int c)
检查所传的字符是否是十进制数字。 int isgraph(int c)
检查所传的字符是否有图形表示法。 int islower(int c)
检查所传的字符是否是小写字母。 int isprint(int c)
检查所传的字符是否是可打印的。 int ispunct(int c)
检查所传的字符是否是标点符号字符。 int isspace(int c)
检查所传的字符是否是空白字符。 int isupper(int c)
检查所传的字符是否是大写字母。 int isxdigit(int c)
检查所传的字符是否是十六进制数字。 //Character conversion functions
int tolower(int c)
把大写字母转换为小写字母。 int toupper(int c)
把小写字母转换为大写字母。

字符类

数字 (Digits)

  • A set of whole numbers { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
  • 完整的数字集合 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }

十六进制数字 (Hexadecimal digits)

  • This is the set of { 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f }
  • 集合 { 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f }

小写字母 (Lowercase letters)

  • This is a set of { a b c d e f g h i j k l m n o p q r s t u v w x y z }
  • 集合 { a b c d e f g h i j k l m n o p q r s t u v w x y z }

大写字母 (Uppercase letters)

  • A set of whole numbers {A B C D E F G H I J K L M N O P Q R S T U V W X Y Z }
  • 集合 {A B C D E F G H I J K L M N O P Q R S T U V W X Y Z }

字母 (Letters)

  • This is a set of lowercase letters and uppercase letters
  • 小写字母和大写字母的集合

字母数字字符 (Alphanumeric characters)

  • This is a set of Digits, Lowercase letters and Uppercase letters
  • 数字、小写字母和大写字母的集合

标点符号字符 (Punctuation characters)

  • This is a set of ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ ] ^ _ ` { | } ~
  • 集合 ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~

图形字符 (Graphical characters)

  • This is a set of Alphanumeric characters and Punctuation characters.
  • 字母数字字符和标点符号字符的集合

空格字符 (Space characters)

  • This is a set of Alphanumeric characters and Punctuation characters.
  • 制表符、换行符、垂直制表符、换页符、回车符、空格符的集合。

可打印字符

  • This is a set of Alphanumeric characters, Punctuation characters and Space characters.
  • 字母数字字符、标点符号字符和空格字符的集合。

控制字符 (Control characters)

  • In ASCII, these characters have octal codes 000 through 037, and 177 (DEL).
  • 在 ASCII 编码中,这些字符的八进制代码是从 000 到 037,以及 177(DEL)。

空白字符 (Blank characters)

  • These are space and tab.
  • 包括空格符和制表符。

字母字符 (Alphabetic characters)

  • This is a set of Lowercase letters and Uppercase letters.
  • 小写字母和大写字母的集合。

ASCII

 0 -  8	       0x00-0x08	控制码 (NUL等)
9 - 9 0x09 制表符 (\t)
10 - 13 0x0A-0x0D 空白符 (\n, \v, \f, \r)
14 - 31 0x0E-0x1F 控制码
32 - 32 0x20 空格
33 - 47 0x21-0x2F !"#$%&'()*+,-./
48 - 57 0x30-0x39 0123456789
58 - 64 0x3a-0x40 :;<=>?@
65 - 70 0x41-0x46 ABCDEF
71 - 90 0x47-0x5A GHIJKLMNOPQRSTUVWXYZ
91 - 96 0x5B-0x60 [\]^_`
97 -102 0x61-0x66 abcdef
103-122 0x67-0x7A ghijklmnopqrstuvwxyz
123-126 0x7B-0x7E {|}~
127 0x7F 退格符 (DEL)

参考文章

C 标准库 - ctype.h的更多相关文章

  1. C标准库<ctype.h>实现

    本文地址:http://www.cnblogs.com/archimedes/p/c-library-ctype.html,转载请注明源地址. 1.背景知识 ctype.h是C标准函数库中的头文件,定 ...

  2. C 标准库 - ctype.h之iscntrl 使用

    iscntrl int iscntrl ( int c ); Check if character is a control character 检查给定字符是否为控制字符,即编码 0x00-0x1F ...

  3. C 标准库 - ctype.h之isalpha使用

    isalpha int isalpha ( int c ); Checks whether c is an alphabetic letter. 检查给定字符是否字母字符,即是大写字母( ABCDEF ...

  4. C 标准库 - ctype.h之isalnum使用

    isalnum int isalnum ( int c ); Checks whether c is either a decimal digit or an uppercase or lowerca ...

  5. C 标准库 - string.h

    C 标准库 - string.h This header file defines several functions to manipulate C strings and arrays. stri ...

  6. C 标准库 - <assert.h>

    C 标准库 - <assert.h> 简介 C 标准库的 assert.h头文件提供了一个名为 assert 的宏,它可用于验证程序做出的假设,并在假设为假时输出诊断消息. 已定义的宏 a ...

  7. C 标准库 - <stdarg.h>

    C 标准库 - <stdarg.h> 简介 stdarg.h 头文件定义了一个变量类型 va_list 和三个宏,这三个宏可用于在参数个数未知(即参数个数可变)时获取函数中的参数. 可变参 ...

  8. C 标准库 - <signal.h>

    C 标准库 - <signal.h> 简介 signal.h 头文件定义了一个变量类型 sig_atomic_t.两个函数调用和一些宏来处理程序执行期间报告的不同信号. 库变量 下面是头文 ...

  9. C 标准库 - <setjmp.h>

    C 标准库 - <setjmp.h> 简介 setjmp.h 头文件定义了宏 setjmp().函数 longjmp() 和变量类型 jmp_buf,该变量类型会绕过正常的函数调用和返回规 ...

随机推荐

  1. java中的软引用,弱引用,虚引用

    http://zh.wikipedia.org/wiki/%E5%BC%B1%E5%BC%95%E7%94%A8 有些语言包含多种强度的弱引用.例如Java,在java.lang.ref[1]包中定义 ...

  2. Replication--复制相关的作业

    复制使用下列作业来执行计划维护和按需维护 作业名称 说明 默认调度 代理历史记录清除:分发 从分发数据库中删除复制代理历史记录. 每十分钟运行一次 分发清除:分发 从分发数据库中删除复制的事务. 停用 ...

  3. 解决<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" 过长

    解决<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" 过长 <i ...

  4. .Net WebApi部署问题

    在IIS上部署web api 完成后,浏览时出现了“The compiler failed with error code -2146232576.”的错误(有时会出现这个情况).主要是 我们在.Ne ...

  5. Selenium框架切换-----Selenium快速入门(七)

    上一篇说了窗口的切换,本篇说说框架的切换. 切换框架:是指切换html中的iframe标签元素或者frame标签元素,注意,并不包括frameset 以下是常用的方法: 方法 说明 WebDriver ...

  6. Unity&C# SingerMonoManager泛型单例

    管理各种管理器 ///为什么需要单例 ///单例模式核心在于对于某个单例类,在系统中同时只存在唯一一个实例,并且该实例容易被外界所访问: ///避免创建过多的对象,意味着在内存中,只存在一个实例,减少 ...

  7. C#基础笔记(第二十一天)

    1.FIle类.Path类.Directory类复习操作文件的File 操作文件,静态类,对文件整体操作.拷贝.删除.剪切等.Directory 操作目录(文件夹),静态类.Path 对文件或目录的路 ...

  8. mongodb 备份还原

    一.简介 说起来数据库的“备份-还原”,在RDBMS系统中,都有很好的支持,也有很多选项可以设置,功能强大,也能自动完成大部分的备份功能,只要当初设置好了就可以了.对于MongoDB文档型的数据库来说 ...

  9. java使用Redis3--完整模板类

    Redis全部指令请参考:http://www.runoob.com/redis/redis-tutorial.html 对应的java模板类 package com.d.work.redis; im ...

  10. 【javascript】—— JS判断浏览器类型、操作系统

    navigator.userAgent : userAgent 属性是一个只读的字符串,声明了浏览器用于 HTTP 请求的用户代理头的值. navigator.platform : platform ...