📄 strstri.c
字号:
/*
strstri.c - case- insensitive version of strstr.
*/
#include <stdlib.h>
#include <string.h>
char *strstri (char *s1, char *s2)
{
char *s, *t, *u;
if ((s1 == NULL) || (s2 == NULL))
return (NULL);
/*
Copy the strings so we can upper case them
*/
s = strdup (s1);
if (s == NULL)
return (NULL);
t = strdup (s2);
if (t == NULL)
{
free (s);
return (NULL);
}
strupr (s);
strupr (t);
/*
Call strstr on the strings. If not NULL, take the
difference between s and u and apply it to s1. Then
set u to s1 for the return.
*/
if ((u = strstr (s, t)) != NULL)
u = s1 + (u - s);
free (s);
free (t);
return (u);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -