青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

笑看風云淡

寵辱不驚,看庭前花開花落;去留無意,望天空云卷云舒
posts - 96, comments - 48, trackbacks - 0, articles - 0
  C++博客 :: 首頁 :: 新隨筆 ::  :: 聚合  :: 管理

C++語言小技巧

Posted on 2007-08-31 16:13 天之驕子 閱讀(362) 評論(0)  編輯 收藏 引用

isalnum(測試字符是否為英文或數(shù)字)
相關(guān)函數(shù)
isalpha,isdigit,islower,isupper
表頭文件
#include<ctype.h>
定義函數(shù)
int isalnum (int c)
函數(shù)說明
檢查參數(shù)c是否為英文字母或阿拉伯數(shù)字,在標準c中相當于使用“isalpha(c) || isdigit(c)”做測試。
返回值
若參數(shù)c為字母或數(shù)字,則返回TRUE,否則返回NULL(0)。
附加說明
此為宏定義,非真正函數(shù)。
范例
/* 找出str 字符串中為英文字母或數(shù)字的字符*/
#include < ctype.h>
main()
{
char str[]=”123c@#FDsP[e?”;
int i;
for (i=0;str[i]!=0;i++ )
if ( isalnum(str[i])) printf(“%c is an alphanumeric character\n”,str[i]);
}
執(zhí)行
1 is an apphabetic character
2 is an apphabetic character
3 is an apphabetic character
c is an apphabetic character
F is an apphabetic character
D is an apphabetic character
s is an apphabetic character
P is an apphabetic character
e is an apphabetic character
 



isalpha (測試字符是否為英文字母)
相關(guān)函數(shù)
isalnum,islower,isupper
表頭文件
#include<ctype.h>
定義函數(shù)
int isalpha (int c)
函數(shù)說明
檢查參數(shù)c是否為英文字母,在標準c中相當于使用“isupper(c)||islower(c)”做測試。
返回值
若參數(shù)c為英文字母,則返回TRUE,否則返回NULL(0)。
附加說明
此為宏定義,非真正函數(shù)。
范例
/* 找出str 字符串中為英文字母的字符*/
#include <ctype.h>
main()
{
char str[]=”123c@#FDsP[e?”;
int i;
for (i=0;str[i]!=0;i++)
if(isalpha(str[i])) printf(“%c is an alphanumeric character\n”,str[i]);
}
執(zhí)行
c is an apphabetic character
F is an apphabetic character
D is an apphabetic character
s is an apphabetic character
P is an apphabetic character
e is an apphabetic character
 



isascii(測試字符是否為ASCII 碼字符)
相關(guān)函數(shù)
iscntrl
表頭文件
#include <ctype.h>
定義函數(shù)
int isascii(int c);
函數(shù)說明
檢查參數(shù)c是否為ASCII碼字符,也就是判斷c的范圍是否在0到127之間。
返回值
若參數(shù)c為ASCII碼字符,則返回TRUE,否則返回NULL(0)。
附加說明
此為宏定義,非真正函數(shù)。
范例
/* 判斷int i是否具有對映的ASCII碼字符*/
#include<ctype.h>
main()
{
int i;
for(i=125;i<130;i++)
if(isascii(i))
printf("%d is an ascii character:%c\n",i,i);
else
printf("%d is not an ascii character\n",i);
}
執(zhí)行
125 is an ascii character:}
126 is an ascii character:~
127 is an ascii character:
128 is not an ascii character
129 is not an ascii character
 



iscntrl(測試字符是否為ASCII 碼的控制字符)
相關(guān)函數(shù)
isascii
表頭文件
#include <ctype.h>
定義函數(shù)
int iscntrl(int c);
函數(shù)說明
檢查參數(shù)c是否為ASCII控制碼,也就是判斷c的范圍是否在0到30之間。
返回值
若參數(shù)c為ASCII控制碼,則返回TRUE,否則返回NULL(0)。
附加說明
此為宏定義,非真正函數(shù)。
 



isdigit(測試字符是否為阿拉伯數(shù)字)
相關(guān)函數(shù)
isxdigit
表頭文件
#include<ctype.h>
定義函數(shù)
int isdigit(int c)
函數(shù)說明
檢查參數(shù)c是否為阿拉伯數(shù)字0到9。
返回值
若參數(shù)c為阿拉伯數(shù)字,則返回TRUE,否則返回NULL(0)。
附加說明
此為宏定義,非真正函數(shù)。
范例
/* 找出str字符串中為阿拉伯數(shù)字的字符*/
#include<ctype.h>
main()
{
char str[]="123@#FDsP[e?";
int i;
for(i=0;str[i]!=0;i++)
if(isdigit(str[i])) printf("%c is an digit character\n",str[i]);
}
執(zhí)行
1 is an digit character
2 is an digit character
3 is an digit character
 



isgraphis(測試字符是否為可打印字符)
相關(guān)函數(shù)
isprint
表頭文件
#include <ctype.h>
定義函數(shù)
int isgraph (int c)
函數(shù)說明
檢查參數(shù)c是否為可打印字符,若c所對映的ASCII碼可打印,且非空格字符則返回TRUE。
返回值
若參數(shù)c為可打印字符,則返回TRUE,否則返回NULL(0)。
附加說明
此為宏定義,非真正函數(shù)。
范例
/* 判斷str字符串中哪些為可打印字符*/
#include<ctype.h>
main()
{
char str[]="a5 @;";
int i;
for(i=0;str[i]!=0;i++)
if(isgraph(str[i])) printf("str[%d] is printable character:%d\n",i,str[i]);
}
執(zhí)行
str[0] is printable character:a
str[1] is printable character:5
str[3] is printable character:@
str[4] is printable character:;
 



islower(測試字符是否為小寫字母)
相關(guān)函數(shù)
isalpha,isupper
表頭文件
#include<ctype.h>
定義函數(shù)
int islower(int c)
函數(shù)說明
檢查參數(shù)c是否為小寫英文字母。
返回值
若參數(shù)c為小寫英文字母,則返回TRUE,否則返回NULL(0)。
附加說明
此為宏定義,非真正函數(shù)。
范例
#include<ctype.h>
main()
{
char str[]="123@#FDsP[e?";
int i;
for(i=0;str[i]!=0;i++)
if(islower(str[i])) printf("%c is a lower-case character\n",str[i]);
}
執(zhí)行
c is a lower-case character
s is a lower-case character
e is a lower-case character
 



isprint(測試字符是(否為可打印字符)
相關(guān)函數(shù)
isgraph
表頭文件
#include<ctype.h>
定義函數(shù)
int isprint(int c);
函數(shù)說明
檢查參數(shù)c是否為可打印字符,若c所對映的ASCII碼可打印,其中包含空格字符,則返回TRUE。
返回值
若參數(shù)c為可打印字符,則返回TRUE,否則返回NULL(0)。
附加說明
此為宏定義,非真正函數(shù)。
范例
/* 判斷str字符串中哪些為可打印字符包含空格字符*/
#include<ctype.h>
main()
{
char str[]="a5 @;";
int i;
for(i=0;str[i]!=0;i++)
if(isprint(str[i])) printf("str[%d] is printable character:%d\n",i,str[i]);
}
執(zhí)行
str[0] is printable character:a
str[1] is printable character:5
str[2] is printable character:
str[3] is printable character:@
str[4] is printable character:;
 



isspace(測試字符是否為空格字符)
相關(guān)函數(shù)
isgraph
表頭文件
#include<ctype.h>
定義函數(shù)
int isspace(int c)
函數(shù)說明
檢查參數(shù)c是否為空格字符,也就是判斷是否為空格('')、定位字符('\t')、CR('\r')、換行('\n')、垂直定位字符('\v')或翻頁('\f')的情況。
返回值
若參數(shù)c為空格字符,則返回TRUE,否則返回NULL(0)。
附加說明
此為宏定義,非真正函數(shù)。
范例
/*將字符串str[]中內(nèi)含的空格字符找出,并顯示空格字符的ASCII碼*/
#include <ctype.h>
main()
{
char str="123c @# FD\tsP[e?\n";
int i;
for(i=0;str[i]!=0;i++)
if(isspace(str[i]))
printf("str[%d] is a white-space character:%d\n",i,str[i]);
}
執(zhí)行
str[4] is a white-space character:32
str[7] is a white-space character:32
str[10] is a white-space character:9 /* \t */
str[16] is a white-space character:10 /* \t */
 



ispunct(測試字符是否為標點符號或特殊符號)
相關(guān)函數(shù)
isspace,isdigit,isalpha
表頭文件
#inlude<ctype.h>
定義函數(shù)
int ispunct(int c)
函數(shù)說明
檢查參數(shù)c是否為標點符號或特殊符號。返回TRUE也就是代表參數(shù)c為非空格、非數(shù)字和非英文字母。
返回值
v若參數(shù)c為標點符號或特殊符號,則返回TRUE,否則返回NULL(0)。
附加說明
此為宏定義,非真正函數(shù)。
范例
/*列出字符串str中的標點符號或特殊符號*/
#include <ctype.h>
main()
{
char str[]="123c@ #FDsP[e?";
int i;
for(i=0;str[i]!=0;i++)
if(ispunct(str[i])) printf("%c\n",str[i]);
}
執(zhí)行
v
@#[?
 



isupper(測試字符是否為大寫英文字母)
相關(guān)函數(shù)
isalpha,islower
表頭文件
#include<ctype.h>
定義函數(shù)
int isupper(int c)
函數(shù)說明
檢查參數(shù)c是否為大寫英文字母。
返回值
若參數(shù)c為大寫英文字母,則返回TRUE,否則返回NULL(0)。
附加說明
此為宏定義,非真正函數(shù)。
范例
/*找出字符串str中為大寫英文字母的字符*/
#include <ctype.h>
main()
{
char str[]="123c@#FDsP[e?";
int i;
for(i=0;str[i]!=0;i++)
if(isupper(str[i])) printf("%c is an uppercase character\n",str[i]);
}
執(zhí)行
F is an uppercase character
D is an uppercase character
P is an uppercase character
 



isxdigit(測試字符是否為16進制數(shù)字)
相關(guān)函數(shù)
isalnum,isdigit
表頭文件
#include<ctype.h>
定義函數(shù)
int isxdigit (int c)
函數(shù)說明
檢查參數(shù)c是否為16進制數(shù)字,只要c為下列其中一個情況則返回TRUE。16進制數(shù)字:0123456789ABCDEF。
返回值
若參數(shù)c為16進制數(shù)字,則返回TRUE,否則返回NULL(0)。
附加說明
此為宏定義,非真正函數(shù)。
范例
/*找出字符串str中為十六進制數(shù)字的字符*/
#include <ctype.h>
main()
{
char str[]="123c@#FDsP[e?";
int i;
for(i=0;str[i]!=0;i++)
if(isxdigit(str[i])) printf("%c is a hexadecimal digits\n",str[i]);
}
執(zhí)行
1 is a hexadecimal digits
2 is a hexadecimal digits
3 is a hexadecimal digits
c is a hexadecimal digits
F is a hexadecimal digits
D is a hexadecimal digits
e is a hexadecimal digits


只有注冊用戶登錄后才能發(fā)表評論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            欧美夜福利tv在线| 亚洲人体一区| 欧美专区日韩专区| 性久久久久久久久| 亚洲大胆视频| 亚洲视频999| 在线精品观看| 亚洲一区尤物| 亚洲日本理论电影| 在线视频欧美一区| 亚洲国产精品久久| 亚洲免费小视频| 亚洲片区在线| 欧美一区二区三区四区在线| 亚洲精品国精品久久99热| 亚洲午夜性刺激影院| 亚洲欧洲精品一区二区| 亚洲一区综合| 99精品99久久久久久宅男| 亚洲欧美日韩直播| 99视频在线精品国自产拍免费观看| 亚洲嫩草精品久久| 一区二区不卡在线视频 午夜欧美不卡在 | 欧美专区18| 亚洲毛片一区| 久久亚洲影院| 久久er精品视频| 欧美日韩一区二区三区在线| 欧美.日韩.国产.一区.二区| 国产精品―色哟哟| 亚洲精品视频一区| 欧美一区二区三区免费大片| 亚洲精品影视| 久久久久久久久久久久久久一区 | 久久这里只有精品视频首页| 欧美一区二区三区成人| 欧美视频精品在线| 亚洲黄色影片| 精品69视频一区二区三区| 亚洲在线第一页| 亚洲永久免费观看| 欧美三级视频| 一区二区三区久久精品| 一区二区三区四区五区视频| 欧美精品免费在线观看| 亚洲电影免费在线观看| 亚洲激情一区二区三区| 可以看av的网站久久看| 免费成人在线视频网站| 精品动漫3d一区二区三区| 久久精品国产一区二区三区| 久久久久久久一区二区| 激情久久久久久| 老司机成人在线视频| 欧美成人免费一级人片100| 亚洲第一视频网站| 欧美高清在线观看| 亚洲美女91| 亚洲欧美综合精品久久成人 | 亚洲视频每日更新| 欧美一级片在线播放| 国产日产欧美一区| 久久午夜视频| 亚洲片在线资源| 亚洲欧美另类国产| 国产中文一区二区三区| 玖玖玖免费嫩草在线影院一区| 亚洲福利av| 国产精品99久久久久久有的能看| 欧美午夜在线视频| 欧美在线视频观看免费网站| 嫩草国产精品入口| 99精品视频免费观看| 国产精品你懂得| 久久精品国产欧美亚洲人人爽| 欧美91精品| 亚洲伊人伊色伊影伊综合网| 国产欧美日韩免费看aⅴ视频| 久久精品亚洲精品| 亚洲人成网在线播放| 亚洲欧美日韩国产| 黄色亚洲精品| 欧美日韩中文字幕在线| 午夜天堂精品久久久久| 欧美大片免费| 亚洲一区二区影院| 激情偷拍久久| 欧美日韩喷水| 一本大道久久a久久精品综合| 亚洲激情欧美激情| 欧美先锋影音| 久久一区二区精品| 一本色道**综合亚洲精品蜜桃冫| 久久久久久久久久久成人| avtt综合网| 国内不卡一区二区三区| 欧美视频免费| 久久综合一区二区| 亚洲在线中文字幕| 亚洲国产精品传媒在线观看 | 久久天天躁狠狠躁夜夜爽蜜月| 亚洲国产导航| 国产视频欧美视频| 欧美日本一区二区视频在线观看| 欧美一区二区三区四区在线观看| 亚洲日本久久| 欧美freesex交免费视频| 欧美亚洲一区| 亚洲性夜色噜噜噜7777| 91久久精品国产| 精品二区视频| 国产真实久久| 国产日韩精品视频一区| 欧美三级欧美一级| 欧美精品三级日韩久久| 久久久综合激的五月天| 羞羞漫画18久久大片| 中文国产亚洲喷潮| 亚洲精品视频免费观看| 亚洲国产精品成人综合色在线婷婷| 久久人人97超碰国产公开结果 | 欧美日韩国产成人在线| 久久久欧美精品| 欧美一区二区视频免费观看| 亚洲午夜一二三区视频| 在线一区二区三区四区五区| 亚洲区欧美区| 亚洲激情视频在线播放| 欧美国产第二页| 美女免费视频一区| 久久综合久色欧美综合狠狠| 国产精品理论片| 欧美日韩蜜桃| 欧美日韩国产在线播放| 欧美另类极品videosbest最新版本| 免费日韩av片| 免费观看一区| 欧美国产视频一区二区| 欧美精品自拍| 欧美日韩卡一卡二| 欧美午夜精品理论片a级按摩 | 欧美激情久久久久久| 欧美成人性生活| 欧美激情1区2区3区| 欧美激情视频一区二区三区在线播放 | aa亚洲婷婷| 一区二区三区国产精品| 一区二区三区三区在线| 亚洲午夜羞羞片| 午夜视频久久久| 久久久久国产精品麻豆ai换脸| 久久人人97超碰精品888 | 免费视频最近日韩| 欧美成人精品在线观看| 亚洲第一福利在线观看| 亚洲影视在线| 亚洲福利视频网站| 亚洲日韩欧美视频一区| 亚洲日本久久| 亚洲一区激情| 久久精品国产91精品亚洲| 久久综合伊人77777麻豆| 欧美国产日产韩国视频| 日韩视频免费看| 先锋影音国产一区| 久久综合给合久久狠狠色| 欧美另类视频| 国产欧美日韩视频| 免费在线欧美视频| 欧美视频在线免费| 国产亚洲美州欧州综合国| 亚洲福利一区| 亚洲男女自偷自拍| 美女尤物久久精品| av成人手机在线| 久久九九久精品国产免费直播| 欧美激情综合| 国语精品中文字幕| 亚洲一二三区视频在线观看| 久久野战av| 一本久久青青| 免费成人你懂的| 国产区精品视频| 亚洲乱码国产乱码精品精98午夜| 欧美一区观看| 亚洲美女av网站| 久久亚洲精品伦理| 国产精品嫩草久久久久| 亚洲精品少妇30p| 久久精品视频在线| 一二三四社区欧美黄| 久久久久久久激情视频| 国产精品久久婷婷六月丁香| 亚洲激情不卡| 久久免费精品日本久久中文字幕| 一本大道久久精品懂色aⅴ| 老牛嫩草一区二区三区日本| 国产欧美日本| 亚洲欧美日韩精品一区二区| 亚洲国产欧美在线|