isalnum()函数检测ch是否是字母和数字,函数原型如下:
int isalnum(int ch);
C语言标准描述如下:
1. Checks if the given character is an alphanumeric character as classified by the current C locale. In the default locale, the following characters are alphanumeric:
(1) digits (0123456789)
(2) uppercase letters (ABCDEFGHIJKLMNOPQRSTUVWXYZ)
(3) lowercase letters (abcdefghijklmnopqrstuvwxyz)
2. The behavior is undefined if the value of ch is not representable as unsigned char and is not equal to EOF.
3. Non-zero value if the character is an alphanumeric character, 0 otherwise.
isalpha()函数检测ch是否是字母,函数原型如下:
int isalpha(int ch);
C语言标准描述如下:
1. Checks if the given character is an alphabetic character, i.e. either an uppercase letter (ABCDEFGHIJKLMNOPQRSTUVWXYZ), or a lowercase letter (abcdefghijklmnopqrstuvwxyz).
2. The behavior is undefined if the value of ch is not representable as unsigned char and is not equal to EOF.
3. Non-zero value if the character is an alphabetic character, zero otherwise.
islower()函数检测ch是否是小写字母,函数原型如下:
int islower(int ch);
C语言标准描述如下:
1. Checks if the given character is classified as a lowercase character according to the current C locale. In the default "C" locale, islower returns true only for the lowercase letters (abcdefghijklmnopqrstuvwxyz).
2. If islower returns true, it is guaranteed that iscntrl, isdigit, ispunct, and isspace return false for the same character in the same C locale.
3. The behavior is undefined if the value of ch is not representable as unsigned char and is not equal to EOF.
4. Non-zero value if the character is a lowercase letter, zero otherwise.
isupper()函数检测ch是否是大写字母,函数原型如下:
int isupper(int ch);
C语言标准描述如下:
1. Checks if the given character is an uppercase character according to the current C locale. In the default "C" locale, isupper returns true only for the uppercase letters (ABCDEFGHIJKLMNOPQRSTUVWXYZ).
2. If isupper returns true, it is guaranteed that iscntrl, isdigit, ispunct, and isspace return false for the same character in the same C locale.
3. The behavior is undefined if the value of ch is not representable as unsigned char and is not equal to EOF.
4. Non-zero value if the character is an uppercase letter, zero otherwise.
isdigit()函数检测ch是否是十进制数字,函数原型如下:
int isdigit(int ch);
C语言标准描述如下:
1. Checks if the given character is a numeric character (0123456789).
2. The behavior is undefined if the value of ch is not representable as unsigned char and is not equal to EOF.
3. Non-zero value if the character is a numeric character, zero otherwise.
isxdigit()函数检测ch是否是十六进制数字,函数原型如下:
int isxdigit(int ch);
C语言标准描述如下:
1. Checks if the given character is a hexadecimal numeric character (0123456789abcdefABCDEF) or is classified as a hexadecimal character.
2. The behavior is undefined if the value of ch is not representable as unsigned char and is not equal to EOF.
3. Non-zero value if the character is an hexadecimal numeric character, zero otherwise.
iscntrl()函数检测ch是否是控制字符,函数原型如下:
int iscntrl(int ch);
C语言标准描述如下:
1. Checks if the given character is a control character, i.e. codes 0x00-0x1F and 0x7F.
2. The behavior is undefined if the value of ch is not representable as unsigned char and is not equal to EOF.
3. Non-zero value if the character is a control character, zero otherwise.
isgraph()函数检测ch是否有图形表示,函数原型如下:
int isgraph(int ch);
C语言标准描述如下:
1. Checks if the given character has a graphical representation, i.e. it is either a number (0123456789), an uppercase letter (ABCDEFGHIJKLMNOPQRSTUVWXYZ), a lowercase letter (abcdefghijklmnopqrstuvwxyz), or a punctuation character (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~), or any graphical character specific to the current C locale.
2. The behavior is undefined if the value of ch is not representable as unsigned char and is not equal to EOF.
3. Non-zero value if the character has a graphical representation character, zero otherwise.
isspace()函数检测ch是否是空白字符,函数原型如下:
int isspace(int ch);
C语言标准描述如下:
1. Checks if the given character is either
(1) A standard white-space character:
(2) Space (0x20, ' '),
(3) Form feed (0x0c, '\f'),
(4) Line feed (0x0a, '\n'),
(5) Carriage return (0x0d, '\r'),
(6) Horizontal tab (0x09, '\t'),
(7) Vertical tab (0x0b, '\v'),
(8) Or a locale-specific white-space character.
2. The behavior is undefined if the value of ch is not representable as unsigned char and is not equal to EOF.
3. Non-zero value if the character is a whitespace character, zero otherwise.
isblank()函数检测ch是否是空字符,函数原型如下:
int isblank(int ch);
C语言标准描述如下:
1. Checks if the given character is a blank character in the current C locale. In the default C locale, only space (0x20) and horizontal tab (0x09) are classified as blank.
2. The behavior is undefined if the value of ch is not representable as unsigned char and is not equal to EOF.
3. Non-zero value if the character is a blank character, zero otherwise.
isprint()函数检测ch是否是可打印的,函数原型如下:
int isprint(int ch);
C语言标准描述如下:
1. Checks if the given character can be printed, i.e. it is either a number (0123456789), an uppercase letter (ABCDEFGHIJKLMNOPQRSTUVWXYZ), a lowercase letter (abcdefghijklmnopqrstuvwxyz), a punctuation character(!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~), or space, or any character classified as printable by the current C locale.
2. The behavior is undefined if the value of ch is not representable as unsigned char and is not equal to EOF.
3. Non-zero value if the character can be printed, zero otherwise.
ispunct()函数检测ch是否是标点符号,函数原型如下:
int ispunct(int ch);
C语言标准描述如下:
1. Checks if the given character is a punctuation character in the current C locale. The default C locale classifies the characters !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ as punctuation.
2. The behavior is undefined if the value of ch is not representable as unsigned char and is not equal to EOF.
3. Non-zero value if the character is a punctuation character, zero otherwise.
tolower()函数将大写字符转换为小写字母,函数原型如下:
int tolower( int ch );
C语言标准描述如下:
1. Converts the given character to lowercase according to the character conversion rules defined by the currently installed C locale.
2. In the default "C" locale, the following uppercase letters ABCDEFGHIJKLMNOPQRSTUVWXYZ are replaced with respective lowercase letters abcdefghijklmnopqrstuvwxyz.
3. Lowercase version of ch or unmodified ch if no lowercase version is listed in the current C locale.
toupper()函数将小写字符转换为大写字母,函数原型如下:
int toupper( int ch );
C语言标准描述如下:
1. Converts the given character to lowercase according to the character conversion rules defined by the currently installed C locale.
2. In the default "C" locale, the following uppercase letters ABCDEFGHIJKLMNOPQRSTUVWXYZ are replaced with respective lowercase letters abcdefghijklmnopqrstuvwxyz.
3. Uppercase version of ch or unmodified ch if no uppercase version is listed in the current C locale.