Determine if the supplied sub-string is contained within the supplied string on a case-insensitive basis

Return TypeFunction nameArguments
boolCstrContainsI(const char*,const char*,)

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

Function Logic:

0:START 1:unknown 2:Return false 3:lower upper len 4:unknown 5:unknown 6:unknown 7:Return true 8:Return false

Function body:

bool CstrContainsI (const char* cpHaystack)const char* cpNeedle, 
{
   //  Category: Text Processing
   //  
   //  Determine if the supplied sub-string is contained within the supplied string on a case-insensitive basis
   //  
   //  Arguments: 1) cpHaystack The source string
   //     2) cpNeedle The being sought
   //  
   //  Returns: True If the needle string occurs in the haystack string
   //     False Otherwise
   const char* i ;         //  Input string iterator
   uint32_t    len ;       //  Test string length
   char        lower ;     //  Lower case of first char of needle
   char        upper ;     //  Upper case of first char of needle
   if (!cpHaystack || !cpHaystack[0]|| !cpNeedle || !cpNeedle[0])
       return false ;
   lower = tolower(cpNeedle[0]);
   upper = toupper(cpNeedle[0]);
   len = strlen(cpNeedle) ;
   for (i = cpHaystack ; *i ; i++)
   {
       if (*i != lower && *i != upper)
           continue ;
       if (!CstrCompareI(i, cpNeedle, len))
           return true ;
   }
   return false ;
}