codecamp

stricmp,strcmpi


 原型:extern int stricmp(char *s1,char * s2);
       
 用法:#include <string.h>
 
 功能:比较字符串s1和s2,但不区分字母的大小写。
 
 说明:strcmpi是到stricmp的宏定义,实际未提供此函数。
       当s1<s2时,返回值<0
       当s1=s2时,返回值=0
       当s1>s2时,返回值>0
 
 举例:


     // stricmp.c
     
     #include <syslib.h>
     #include <string.h>
     main()
     {
       char *s1="Hello, Programmers!";
       char *s2="Hello, programmers!";
       int r;
       
       clrscr();
       
       r=stricmp(s1,s2);
       if(!r)
         printf("s1 and s2 are identical");
       else
       if(r<0)
         printf("s1 less than s2");
       else
         printf("s1 greater than s2");
       
       getchar();
       return 0;
     }


stricmp,strcmpi
strcspn
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

alloi动态内存

stdio输入输出函数

stdlib基础库函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }