字符串函数strnicmp,strncmpi
来源:互联网 发布:大数据软件平台公司 编辑:程序博客网 时间:2024/06/05 13:26
原型:extern int strnicmp(char *s1,char * s2,int n);
用法:#include <string.h>
功能:比较字符串s1和s2的前n个字符但不区分大小写。
说明:strncmpi是到strnicmp的宏定义
当s1<s2时,返回值<0
当s1=s2时,返回值=0
当s1>s2时,返回值>0
举例:
// strnicmp.c
#include <syslib.h>
#include <string.h>
main()
{
char *s1="Hello, Programmers!";
char *s2="Hello, programmers!";
int r;
clrscr();
r=strnicmp(s1,s2,strlen(s1));
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;
}
相关函数:bcmp,memcmp,stricmp,strncmp
(摘自 http://www.ggv.com.cn/forum/clib/string/strstr.html)
用法:#include <string.h>
功能:比较字符串s1和s2的前n个字符但不区分大小写。
说明:strncmpi是到strnicmp的宏定义
当s1<s2时,返回值<0
当s1=s2时,返回值=0
当s1>s2时,返回值>0
举例:
// strnicmp.c
#include <syslib.h>
#include <string.h>
main()
{
char *s1="Hello, Programmers!";
char *s2="Hello, programmers!";
int r;
clrscr();
r=strnicmp(s1,s2,strlen(s1));
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;
}
相关函数:bcmp,memcmp,stricmp,strncmp
(摘自 http://www.ggv.com.cn/forum/clib/string/strstr.html)
- 字符串函数strnicmp,strncmpi
- strnicmp,strncmpi函数
- strnicmp,strncmpi函数
- strnicmp,strncmpi方法
- strnicmp,strncmpi方法
- strnicmp函数
- strnicmp函数
- strcmp,stricmp,strcmpi,strncmp,strnicmp,strncmpi,strcat,strncat比较
- strnicmp函数原型
- strnicmp
- strnicmp的用法
- strnicmp ( )【C语言库函数源代码】
- strcmp, strcpy, memcpy, strnicmp 实现
- strcmp,stricmp,strncmp,strncmpi,strcat,strncat
- strnicmp() 与测试用例的理解
- 字符串函数
- 字符串函数
- 字符串函数
- 字符串函数strlwr
- [实时更新]草木瓜BLOG发表的全部文章
- 字符串函数strncat
- 字符串函数strncat
- 字符串函数strncmp
- 字符串函数strnicmp,strncmpi
- IEEE 1588 Sync和Follow_Up格式
- c#中Hashtable用法简述
- 字符串函数strncpy
- 字符串函数strpbrk
- 电子地图
- 字符串函数strrev
- 字符串函数strset
- 字符串函数strstr