字符函数库 cctype
<cctype> (ctype.h)
Character handling functions
This header declares a set of functions to classify and transform individual characters.
Functions
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 0represents true.
There are two sets of functions:
Character classification functions
They check whether the character passed as parameter belongs to a certain category:
- isalnum
- Check if character is alphanumeric (function )
- isalpha
- Check if character is alphabetic (function )
- isblank
- Check if character is blank (function )
- iscntrl
- Check if character is a control character (function )
- isdigit
- Check if character is decimal digit (function )
- isgraph
- Check if character has graphical representation (function )
- islower
- Check if character is lowercase letter (function )
- isprint
- Check if character is printable (function )
- ispunct
- Check if character is a punctuation character (function )
- isspace
- Check if character is a white-space (function )
- isupper
- Check if character is uppercase letter (function )
- isxdigit
- Check if character is hexadecimal digit (function )
Character conversion functions
Two functions that convert between letter cases:
- tolower
- Convert uppercase letter to lowercase (function )
- toupper
- Convert lowercase letter to uppercase (function )
For the first set, here is a map of how the original 127-character ASCII set is considered by each function (an x indicates that the function returns true on that character)
ASCII values | characters | iscntrl | isblank | isspace | isupper | islower | isalpha | isdigit | isxdigit | isalnum | ispunct | isgraph | isprint |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0x00 .. 0x08 | NUL, (other control codes) | x | |||||||||||
0x09 | tab ('\t') | x | x | x | |||||||||
0x0A .. 0x0D | (white-space control codes:'\f','\v','\n','\r') | x | x | ||||||||||
0x0E .. 0x1F | (other control codes) | x | |||||||||||
0x20 | space (' ') | x | x | x | |||||||||
0x21 .. 0x2F | !"#$%&'()*+,-./ | x | x | x | |||||||||
0x30 .. 0x39 | 0123456789 | x | x | x | x | x | |||||||
0x3a .. 0x40 | :;<=>?@ | x | x | x | |||||||||
0x41 .. 0x46 | ABCDEF | x | x | x | x | x | x | ||||||
0x47 .. 0x5A | GHIJKLMNOPQRSTUVWXYZ | x | x | x | x | x | |||||||
0x5B .. 0x60 | [\]^_` | x | x | x | |||||||||
0x61 .. 0x66 | abcdef | x | x | x | x | x | x | ||||||
0x67 .. 0x7A | ghijklmnopqrstuvwxyz | x | x | x | x | x | |||||||
0x7B .. 0x7E | {|}~ | x | x | x | |||||||||
0x7F | (DEL) | x |
The characters in the extended character set (above 0x7F) may belong to diverse categories depending on the locale and the platform. As a general rule, ispunct, isgraph and isprint return
true on these for the standard C locale on most platforms supporting extended character sets.
字符函数库 cctype的更多相关文章
- 学习笔记二十三——字符函数库cctype【转】
本文转载自: 字符函数库cctype 在头文件cctype(ctype.h)中定义了一些函数原型,可以简化输入确定字符是否为大写字母.数字.标点符号等工作. 例如: 如果ch是一个字母,则isalph ...
- 循环 与 分支语句 和 字符函数库cctype 文件简单处理
循环 for循环 while循环 do while循环 通常,入口条件循环比出口条件循环好,因为循环开始前对条件进行检查 c++11基于范围的for循环 对数组(或容器类,如:vector和a ...
- C++学习笔记之字符函数库cctype
C++从C语言继承了一个与字符相关的.非常方便的函数软件包,它可以简化诸如确定字符是否为大写字母.数字.标点符号等工作,这些函数原型是在头文件cctype(老式风格ctype.h)中定义的. 下表对这 ...
- 字符函数库 - cctype 和 climits 中的符号常量
一. C++从C语言中继承一个与字符相关的.非常方便的函数软件包,他可以简化诸如确定字符是否为大写字母‘数字.标点符号等工作,这些函数的原型在头文件cctype(老式的为ctype.h)中定义的.例如 ...
- python函数库及函数标准库
一.系统库提供的内部函数 字符函数库: 1)str.islower() :字符串是否全部是小写 2)str.isspace() :字符串是否为空 3)help(str):查询字符串函数库 4)str. ...
- PHP移动互联网开发笔记(5)——基础函数库
一.数学函数库 ● floor 舍一取整(向下取整) float floor (float $value); <?php echo(floor(0.60)."<br>&qu ...
- cctype头文件(字符处理库)的使用
C++ 中cctype头文件的使用 头文件cctype(字符处理库)中定义了有关字符判断与处理的库函数,使用前要包含头文件: #include <cctype> using namespa ...
- PHP用mb_string函数库处理与windows相关中文字符
昨天想批处理以前下载的一堆文件,把文件里的关键内容用正则匹配出来,集中处理.在操作文件时遇到一个问题,就是windows操作系统中的编码问题. 我们都知道windows中(当然是中文版),文件名和文件 ...
- 【C++实现python字符串函数库】二:字符串匹配函数startswith与endswith
[C++实现python字符串函数库]字符串匹配函数startswith与endswith 这两个函数用于匹配字符串的开头或末尾,判断是否包含另一个字符串,它们返回bool值.startswith() ...
随机推荐
- Effective JavaScript :第五章
1.使用Object的直接实例构造轻量级的字典 字典就是可变长的字符串与值得映射集合.JavaScript甚至提供了枚举一个对象属性名的利器——for...in循环. var dict = { ali ...
- mybatis 批量插入值的sql
<insert id="insertAwardPic" useGeneratedKeys="true" parameterType="java. ...
- 一步一步学EF系列2【最简单的一个实例】
整个文章我都会用最简单,最容易让人理解的方式给大家分享和共同学习.(由于live Writer不靠谱 又得补发一篇) 一.安装 Install-Package EntityFramework 二.简单 ...
- mybatis遇见的奇葩问题(返回null)
1.问题描述 select 语句没有问题,执行完毕后通过日志也可以看出 select到数据了,但是拿到的值就是null 2.原因 原来是有人将对象变量命名给改了,导致select到结果后不能映射成为对 ...
- CSS的属性
一,可继承属性<!DOCTYPE html><html lang="en"><head> <meta charset="UTF- ...
- 美化type="file"控件
对于type="file"而言是一个不大好看的控件.如果不美化他一下,总感觉自己的网站有些缺乏了美感 上代码: <!DOCTYPE html> <html> ...
- HYSBZ 1053 反质数
input n 1<=n<=2000000000 output 不大于n的最大反质数 对于任何正整数x,其约数的个数记作g(x).例如g(1)=1.g(6)=4.如果某个正整数x满足:g( ...
- sql 判断表是否存在,判断列是否存在
判断表是否存在: 语法: SELECT * FROM dbo.SysObjects where id = object_id(N'表名') 例子: SELECT * FROM dbo.SysObjec ...
- js 放置 cookie、获取 cookie、删除 cookie
这块TM的删不掉 代码如下: // 自定义 js cookies var mycookie = { // 放置 set : function(name,value){ var Days = 1; // ...
- ios UIApplocation 中APP启动方式
iOS app启动的方式有哪些: 自己启动(用户手动点击启动) urlscheme启动(关于urlScheme的详解)http://www.cnblogs.com/sunfuyou/p/6183064 ...