The Standard C Library for Linux:ctype.h

scwk002

scwk002

2016-02-19 12:33

今天给大家分享的是由图老师小编精心为您推荐的The Standard C Library for Linux:ctype.h,喜欢的朋友可以分享一下,也算是给小编一份支持,大家都不容易啊!

  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
展开更多 50%)
分享

猜你喜欢

The Standard C Library for Linux:ctype.h

编程语言 网络编程
The Standard C Library for Linux:ctype.h

The Standard C Library for Linux:stdlib.h

编程语言 网络编程
The Standard C Library for Linux:stdlib.h

s8lol主宰符文怎么配

英雄联盟 网络游戏
s8lol主宰符文怎么配

The Standard C Library for Linux

编程语言 网络编程
The Standard C Library for Linux

LINUX C语言开发简介

编程语言 网络编程
LINUX C语言开发简介

lol偷钱流符文搭配推荐

英雄联盟 网络游戏
lol偷钱流符文搭配推荐

Linux上搭建C/C++IDE开发环境

Linux Linux命令 Linux安装 Linux编程 Linux桌面 Linux软件 Linux内核 Linux管理
Linux上搭建C/C++IDE开发环境

.c文件和.h文件的概念与联系

C语言教程 C语言函数
.c文件和.h文件的概念与联系

lolAD刺客新符文搭配推荐

英雄联盟
lolAD刺客新符文搭配推荐

重用java.util.Observable类

重用java.util.Observable类

使用css如何制作时间ICON方法实践

使用css如何制作时间ICON方法实践
下拉加载更多内容 ↓