概述
在写一个判断POST和GET时用到不区分大小写的字符串比较。
头文件都是string. h
windows平台:
函数:stricmp(char *str1, char *str2), strnicmp(char *str1, char *str2, size_t n).
Linux平台:
函数:strcasecmp(char *str1, char *str2), strncasecmp(char *str1, char *str2, size_t n).
下面给出linux下两个函数的实现
#include
#include
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)strcasecmp.c8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
typedef unsigned char u_char;
/*
* This array is designed for mapping upper and lower case letter
* together for a case independent comparison. The mappings are
* based upon ascii character sequences.
*/
static const u_char charmap[] = {
'