Purpose: Compare two strings (cstr) on a case sensitive basis. This does not crash when given null arguments.

Return TypeFunction nameArguments
int32_tCstrCompare(const char*,const char*,uint32_t,)

Declared in file: hzTextproc.h
Defined in file : hzTextproc.cpp

Function Logic:

0:START 1:unknown 2:unknown 3:Return 0 4:unknown 5:Return 0 6:Return *pB 7:unknown 8:Return *pA 9:unknown 10:unknown 11:unknown 12:Return *pA-*pB

Function body:

int32_t CstrCompare (const char* pA)const char* pB, uint32_t nMaxlen, 
{
   //  Category: Text Processing
   //  
   //  Purpose: Compare two strings (cstr) on a case sensitive basis. This does not crash when given null arguments.
   //  
   //  Arguments: 1) pA  First string
   //     2) pB  Second string
   //     3) nMaxlen Max length to compare (default 0 for no maximum)
   //  
   //  Returns: +1 If pA is lexically greater than pB within the specified length
   //     -1 If pA is lexically less than pB within the specified length
   //     0 If pA and pB are equal within the specified length
   _hzfunc("CstrCompare") ;
   uint32_t    nCount ;    //  Byte counter
   if (!pA || !pA[0])
   {
       if (!pB)    return 0;
       if (!pB[0]) return 0;
       return *pB ;
   }
   if (!pB || !pB[0])
       return *pA ;
   if (!nMaxlen)
       for (; *pA && *pB && *pA == *pB ; pA++, pB++) ;
   else
       for (nCount = 0; nCount < nMaxlen && *pA && *pB && *pA == *pB ; nCount++, pA++, pB++) ;
   return *pA - *pB ;
}