码迷,mamicode.com
首页 > 编程语言 > 详细

C语言 实现strstri不区分大小写查找字符串

时间:2015-04-03 17:29:03      阅读:682      评论:0      收藏:0      [点我收藏+]

标签:


char* strstri(char * inBuffer, char * inSearchStr)
{
    char*  currBuffPointer = inBuffer;

    while (*currBuffPointer != 0x00)
    {
        char* compareOne = currBuffPointer;
        char* compareTwo = inSearchStr;
        //统一转换为小写字符
        while (tolower(*compareOne) == tolower(*compareTwo))
        {
            compareOne++;
            compareTwo++;
            if (*compareTwo == 0x00)
            {
                return (char*) currBuffPointer;
            }

        }
        currBuffPointer++; 
    }
    return NULL;
}

C语言 实现strstri不区分大小写查找字符串

标签:

原文地址:http://blog.csdn.net/jeanphorn/article/details/44856317

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!