C Standard Library: 2 Character Class Tests: <ctype.h>
2013-03-21 09:37
477 查看
2 Character Class Tests: <ctype.h>
The header <ctype.h> declares functions for testing characters. For each function, the
argument list is an int, whose value must be EOF or representable as an unsigned char, and
the return value is an int. The functions return non-zero (true) if the argument c satisfies the
condition described, and zero if not.
isalnum(c) isalpha(c) or isdigit(c) is true
isalpha(c) isupper(c) or islower(c) is true
iscntrl(c) control character
isdigit(c) decimal digit
isgraph(c) printing character except space
islower(c) lower-case letter
isprint(c) printing character including space
ispunct(c) printing character except space or letter or digit
isspace(c) space, formfeed, newline, carriage return, tab, vertical tab
isupper(c) upper-case letter
isxdigit(c) hexadecimal digit
In the seven-bit ASCII character set, the printing characters are 0x20 (' ') to 0x7E ('-');
the control characters are 0 NUL to 0x1F (US), and 0x7F (DEL).
In addition, there are two functions that convert the case of letters:
int tolower(c) convert c to lower case
int toupper(c) convert c to upper case
If c is an upper-case letter, tolower(c) returns the corresponding lower-case letter,
toupper(c) returns the corresponding upper-case letter; otherwise it returns c.
The header <ctype.h> declares functions for testing characters. For each function, the
argument list is an int, whose value must be EOF or representable as an unsigned char, and
the return value is an int. The functions return non-zero (true) if the argument c satisfies the
condition described, and zero if not.
isalnum(c) isalpha(c) or isdigit(c) is true
isalpha(c) isupper(c) or islower(c) is true
iscntrl(c) control character
isdigit(c) decimal digit
isgraph(c) printing character except space
islower(c) lower-case letter
isprint(c) printing character including space
ispunct(c) printing character except space or letter or digit
isspace(c) space, formfeed, newline, carriage return, tab, vertical tab
isupper(c) upper-case letter
isxdigit(c) hexadecimal digit
In the seven-bit ASCII character set, the printing characters are 0x20 (' ') to 0x7E ('-');
the control characters are 0 NUL to 0x1F (US), and 0x7F (DEL).
In addition, there are two functions that convert the case of letters:
int tolower(c) convert c to lower case
int toupper(c) convert c to upper case
If c is an upper-case letter, tolower(c) returns the corresponding lower-case letter,
toupper(c) returns the corresponding upper-case letter; otherwise it returns c.
相关文章推荐
- C Standard Library:5 Utility Functions: <stdlib.h>
- c++ standard library 学习笔记-auto_ptr<T> 注意事项
- C/C++ standard library -- <cstring>(string.h)
- c++ standard library <numeric> accumulate demo
- standard c library <string.h>
- C Standard Library: 6 Diagnostics: <assert.h>
- C Standard Library: 7 Variable Argument Lists: <stdarg.h>
- C Standard Library: 11 Implementation-defined Limits: <limits.h> and <float.h>
- C Standard Library: 3 String Functions: <string.h>
- C Standard Library: 8 Non-local Jumps: <setjmp.h>
- C Standard Library: 1 Input and Output: <stdio.h>
- C Standard Library:4 Mathematical Functions: <math.h>
- C Standard Library: 9 Signals: <signal.h>
- C Standard Library: 10 Date and Time Functions: <time.h>
- android android.view.InflateException: Binary XML file line #14: Error inflating class<unknown>
- Class<T>在BaseDao<T>作用
- template<class T>函数模板
- 错误集_ nib文件加载,Unknown class <XXClass> in Interface Builder file.,Undefined symbolsfor architecture
- org.objectweb.asm.ClassWriter.<init>(I)V异常
- P.J.Plauger<ctype.h>