名字
         strstr, strcasestr - 在字符串中定位一个子串
 
 
概要
         #include <string.h>
 
         char *strstr(const char *haystack, const char *needle);
         char *strcasestr(const char *haystack, const char *needle); // 是GNU的扩展
 
 
描述
         strstr()函数在haystack中找到needle子串第一次出现的位置。
         strcasestr()函数功能通strstr一样,但是忽略大小写。
 
 
返回值
         找到,返回找到的子串的首地址
         没有找到,返回NULL
 
 
例子
 
strstr.c
 
#include <string.h>
#include <stdio.h>
int main(int argc, const char *argv[])
{
    char buf[] = "i am lip!";
    printf("%s\n", strstr(buf, "am"));
    return 0;
}
 > ./a.out 
 > am lip!