国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

The Standard C Library for Linux:ctype.h

2019-11-17 05:39:35
字體:
來源:轉載
供稿:網友

  Part Four: <ctype.h> Character Handling
By James M. Rogers

--------------------------------------------------------------------------------

The last article was on <stdio.h> Input and Output. This article is on <ctype.h> character handling.

Character handling allows us to clasify characters as alpha, digit, hexdigit, whitespace, PRintable, lowercase, uppercase, punctuation and to map to and from the upper and lowercase alphabets. Most importantly <ctype.h> implements these functions in a non-system dependent way.

If you write your program assuming that every computer is an ASCII computer you will have trouble porting your program to non ASCII machines. If you write your character handling functions in terms of these functions your program will be mUCh more portable to other platforms.

I am assuming a knowledge of c programming on the part of the reader. There is no guarantee of accuracy in any of this information nor suitability for any purpose.

The program example that I will do this month will go thru the entire 8bit ASCII range and tell us to which classes any one chacter belongs. The example is rogers_example04.c. The output the program generates will be an Html document and the run from my system is rogers_example04.html .
This program can be used as a cgi-bin script and is a demonstration of the flexibility of the c language.


As always, if you see an error in my documentation please tell me and I will correct myself in a later document. See corrections at end of the document to review corrections to the previous articles.

Character Handling


#include <ctype.h>

int isalpha(int c);
int isalnum(int c);
int isdigit(int c);
int isxdigit(int c);

int iscntrl(int c);
int isspace(int c);

int ispunct(int c);
int isgraph(int c);
int isprint(int c);

int islower(int c);
int isupper(int c);

int tolower(int c);
int toupper(int c);

isalpha returns true if the character is in the range of A-Z or a-z.
isalnum returns true if the character is in the range of A-Z or a-z or 0-9.

isdigit returns true if the character is in the range of 0-9.

isxdigit returns true if the character is in the range of 0-9 or a-f or A-F.

iscntrl returns true if the character is in the set (FF, NL, CR, HT, VT, BEL or BS).


isspace returns true if the character is in the set (space, FF, NL, CR, HT or VT).

ispunct returns true if the character is a nonalnum, nonspace and noncntrl.

isgraph returns true if the character isalnum or ispunct.

isprint returns true if the character isspace or isgraph.

islower returns true if the character is in the range of a-z.

isupper returns true if the character is in the range of A-Z.

tolower if isupper return the lowercase character otherwise return the character.

toupper if islower return the uppercase character otherwise return the character.

From:www.linuxgazette.com

上一篇:GTK+ FAQ

下一篇:gcc manual page (二)

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 丹凤县| 英山县| 特克斯县| 团风县| 金溪县| 云梦县| 新沂市| 安多县| 清流县| 嘉禾县| 陕西省| 南宫市| 卢氏县| 樟树市| 双鸭山市| 石台县| 弋阳县| 和政县| 车险| 定结县| 绥芬河市| 临高县| 依兰县| 论坛| 灵宝市| 渭源县| 贵溪市| 德保县| 简阳市| 喀什市| 杭锦旗| 习水县| 昌黎县| 土默特左旗| 易门县| 新泰市| 贵德县| 沁阳市| 靖州| 方山县| 长葛市|