strcmps.c
来自「Microsoft MS-DOS6.0 完整源代码」· C语言 代码 · 共 47 行
C
47 行
/* strcmps - compare strings and ignore spaces */
#include <ctype.h>
#include "..\h\tools.h"
/* compare two strings, ignoring white space, case is significant, return
* 0 if identical, <>0 otherwise
*/
strcmps (p1, p2)
register const char *p1, *p2;
{
while (TRUE) {
while (isspace (*p1))
p1++;
while (isspace (*p2))
p2++;
if (*p1 == *p2)
if (*p1++ == 0)
return 0;
else
p2++;
else
return *p1-*p2;
}
}
/* compare two strings, ignoring white space, case is not significant, return
* 0 if identical, <>0 otherwise
*/
strcmpis (p1, p2)
register const char *p1, *p2;
{
while (TRUE) {
while (isspace (*p1))
p1++;
while (isspace (*p2))
p2++;
if (toupper (*p1) == toupper (*p2))
if (*p1++ == 0)
return 0;
else
p2++;
else
return *p1-*p2;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?