比较两个字串的函数

 /*****************************************************************************
 * FUNCTION
 *  mmi_wcscmp
 * DESCRIPTION
 *  Compares two UCS2 encoded strings(wide-character) and returns an integer to
 *  indicate whether the destination string is less than the source string,
 *  the two are equal, or whether the destination string is greater than the
 *  source string.
 * PARAMETERS         
 *  str_src   [IN]  UCS2 encoded destination string(wide-character) for
 *                  left-hand side of comparison.
 *  str_dst   [IN]  UCS2 encoded source string(wide-character) for right-hand
 *                  side of comparison.      
 * RETURNS
 *  returns <0 if str_src <  str_dst
 *  returns  0 if str_src == str_dst
 *  returns >0 if str_src >  str_dst
 *****************************************************************************/
S32 mmi_wcscmp(const U16 *str_src, const U16 *str_dst)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
   
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/   
    return (S32) app_ucs2_wcscmp((const kal_wchar *)str_src, (const kal_wchar *)str_dst);
}

 

kal_int32 app_ucs2_wcscmp(const kal_wchar *str_src, const kal_wchar *str_dst)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
   
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    while((*str_src == *str_dst) && *str_src)
    {
        ++str_src, ++str_dst;       
    }     

    return (kal_int32)(*str_src - *str_dst);
}

 

 

你可能感兴趣的:(String,function,Integer,Parameters,DST,variables)