⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cms_wapstring.c

📁 wap 协议栈 包括1.2 和2.0 由c开发 基于brew平台
💻 C
字号:
/******************************************************************************

 C   M O D U L E   F I L E

 (c) Copyright MobileSoft Technology (NanJing) Co., LTD. 2001-2002
 ALL RIGHTS RESERVED
	
*******************************************************************************

 Project Name: WAP STACK Ver1.20

 Written By  : MobileSoft Technology

 File Name   : Cms_Malloc.c 

 Last Modify : 06/22/2002

******************************************************************************/

#include "Cms_WAPString.h"

/*=========================================*/

CMS_S32 Cms_strcasecmp(P_CMS_U8 string_1, P_CMS_U8 string_2)
{
    /*
     * If either is 0, they are not equal, even if both are 0
     */
    if ((string_1 == NULL)||(string_2 == NULL))
    {
        return 1;
    }

    /*
     * While not at the end of the string, if they ever differ
     * they are not equal.
     */
    while ((*string_1 != '\0')&&(*string_2 != '\0'))
    {
        if (Cms_TOLOWER((CMS_U8) *string_1) != Cms_TOLOWER((CMS_U8) *string_2))
        {
            return 1 ;
        }
        string_1++;
        string_2++;
    }

    /*
     * One of the strings has ended, if they are both ended, then they
     * are equal, otherwise not.
     */
    if ((*string_1 == '\0')&&(*string_2 == '\0'))
    {
        return 0;
    }
    else
    {
        return 1;
    }
}


CMS_S32 Cms_strncasecmp(P_CMS_U8 string_1, P_CMS_U8 string_2, CMS_S32 n)
{
	CMS_S32 count = 0;

    /*
     * If either is 0, they are not equal, even if both are 0
     */
    if ((string_1 == 0)||(string_2 == 0))
    {
        return 1;
    }

    /*
     * While not at the end of the string, if they ever differ
     * they are not equal.
     */
    while ((*string_1 != '\0')&&(*string_2 != '\0')&& count < n)
    {
        if (Cms_TOLOWER((CMS_U8) *string_1) != Cms_TOLOWER((CMS_U8) *string_2))
        {
            return 1;
        }
        string_1++;
        string_2++;
	  count++;
    }

    /*
     * One of the strings has ended, if they are both ended, then they
     * are equal, otherwise not.
     */
    if ((*string_1 == '\0')&&(*string_2 == '\0') && count == n)
    {
        return 0;
    }
    else
    {
        return 1;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -