語言字符串處理函數(shù)歸總比較全_第1頁
語言字符串處理函數(shù)歸總比較全_第2頁
語言字符串處理函數(shù)歸總比較全_第3頁
語言字符串處理函數(shù)歸總比較全_第4頁
語言字符串處理函數(shù)歸總比較全_第5頁
免費預覽已結束,剩余27頁可下載查看

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

字符串處理函數(shù)介原型:externintbcmp(constvoid*s1,constvoid*s2,int用法:#includes1s2的前n//#include{char*s2="Goldenglobal printf("s1equaltos2in7bytes");printf("s1notequaltos2in7printf("s1equaltos2in12bytes");printf("s1notequaltos2in12return0;}原型:externvoidbcopy(constvoid*src,void*destint用法:#include//#include{chard[20]; printf("s:printf("d: //bcopyignorenullinstringreturn0;}原型:externvoidbzero(void*s,int用法:#include說明:bzero無返回值。//#include{{inta;floatf;}char //structinitializationtozeroprintf("Initailreturn0;}原型:externvoid y(void*dest,void*src,unsignedcharch,unsignedint用法:#includech則停止NULL。ch被。// #include{chard[20],*p; { printf("Charfound:%s.\n",d);}printf("Charnotreturn0;}原型:externvoid*memchr(void*buf,charch,unsigned用法:#includeNULL//#include{char*p;printf("Notreturn0;} 原型:externintmemcmp(void*buf1,void*buf2,unsignedint用法:#includebuf1和buf2count

當buf1<buf2時,返回值<0當buf1=buf2時,返回值=0當buf1>buf2時,返回值//#include{char*s1="o,Programmers!";char*s2="o,programmers!";intr;printf("s1ands2areidentical");printf("s1lessthans2");printf("s1greaterthanreturn0;}原型:externvoid*memcpy(void*dest,void*src,unsignedint用法:#include功能:由src所指內存區(qū)域count個字節(jié)到dest所指內存區(qū)域。//#include{chard[20];return0;} 原型:externintmemicmp(void*buf1,void*buf2,unsignedint用法:#includebuf1和buf2count個字節(jié)但不區(qū)分字母的大小寫。說明:memicmp同memcmp的唯一區(qū)別是memicmp不區(qū)分大小寫字母。當buf1<buf2時,返回值<0當buf1=buf2時,返回值=0當buf1>buf2時,返回值//#include{char*s1="o,Programmers!";char*s2="o,programmers!";intr;printf("s1ands2areidentical");printf("s1lessthans2");printf("s1greaterthanreturn0;}原型:externvoid*memmove(void*dest,constvoid*src,unsignedint用法:#include//#include{return0;} 原型:externvoid*memset(void*buffer,intc,int用法:#include說明:返回指向buffer的指針。//#include{return0;}原型:extern原型:externvoidmovmem(void*src,void*dest,unsignedint用法:#include//#include{movmem(s,s+7,strlen(s)-s[strlen(s)-return0;}原型:externvoidsetmem(void*buf,unsignedintcount,char用法:#include說明:返回指向buf的指針。//#include{return0;}原型:externchar*stpcpy(char*dest,char用法:#include返回指向dest結尾處字符(NULL)的指針。//#include{chard[20];return0;}原型:externchar*strcat(char*dest,char用法:#include返回指向dest的指針。//#include{char*s="View";return0;}原型:externchar*strchr(char*s,char用法:#include//#include{char*p;printf("Notreturn0;}原型:externintstrcmp(char*s1,char*用法:#include//#include{char*s1="o,Programmers!";char*s2="o,programmers!";intr;printf("s1ands2areidentical");printf("s1lessthans2");printf("s1greaterthanreturn0;}原型:externintstricmp(char*s1,char*用法:#include當s1<s2時,返回值<0//#include{char*s1="o,Programmers!";char*s2="o,programmers!";intr;printf("s1ands2areidentical");printf("s1lessthans2");printf("s1greaterthanreturn0;}原型:externchar*strcpy(char*dest,char用法:#include返回指向dest的指針。//#include{chard[20];return0;} 用法:#include//#include{char*r="new";intn;printf("Thecharbothins1ands2is:return0;}原型:externchar*strdup(char用法:#include//#include{char*d;return0;} 原型:externintstrlen(char用法:#include//#include{printf("%shas%dreturn0;}原型:externchar*strlwr(char用法:#include//#include{return0;}原型:externchar*strncat(char*dest,char*src,int用法:#includesrc所指字符串的前n個字符添加到dest結尾處(覆蓋dest結尾處的'\0')并添加'\0'。//#include{chard[20]="GoldenGlobal";return0;}原型:externintstrcmp(char*s1,char*s2,int用法:#includes1s2的前n個字符。//strncmp.c#include<string.h>{char*s1="o,Programmers!";char*s2="o,programmers!";intr;printf("s1ands2areidentical");printf("s1lessthans2");printf("s1greaterthanprintf("s1ands2areidentical");printf("s1lessthans2");printf("s1greaterthans2");return}原型:externintstrnicmp(char*s1,char*s2,int用法:#includes1s2的前n個字符但不區(qū)分大小寫。說明:strncmpi是到strnicmp的宏定義//#include{char*s1="o,Programmers!";char*s2="o,programmers!";intr;printf("s1ands2areidentical");printf("s1lessthans2");printf("s1greaterthanreturn0;}原型:externchar*strncpy(char*dest,char*src,int用法:#include

srcnNULLNULL字符結束。src和dest所指內存區(qū)域不可以且dest必須有足夠的空間來容納src的字符串。返回指向dest的指針。//#include{char*s="GoldenGlobalchar*d="o,GGVProgrammers";char*p=strdup(s); //enable6linesreturn0;} 原型:externchar*strpbrk(char*s1,char用法:#include//#include{char*s1=" char*s2="BIT";printf("Notprintf("Notreturn0;}原型:externchar*strrev(char用法:#includeNULL//#include{ eTo //6linesperscreenreturn0;}原型:externchar*strset(char*schar用法:#include說明:返回指向s的指針。//#include{return0;}原型:externchar*strstr(char*haystack,char用法:#include說明:返回指向第一次出現(xiàn)needle位置的指針,如果沒找到則返回NULL。//#include{char*l="lob";charprintf("Notreturn0;}

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論