Return TypeFunction nameArguments
hzEcodeSplitCstrOnCstr(hzArray<hzString>&,const char*,const char*,)

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

Function Logic:

0:START 1:hzArray::Clear 2:!input||!input[0] 3:Return E_ARGUMENT 4:!delim||!delim[0] 5:Return E_ARGUMENT 6:strlen nLen i 7:; 8:*i==0 9:nPos>nRef 10:hzString::SetValue 11:hzArray::Add 12:*i==delim[0] 13:CstrCompare(i,delim) 14:nPos>nRef 15:hzString::SetValue 16:hzArray::Add hzString::Clear nRef i nPos 17:items items 18:Return E_OK

Function body:

hzEcode SplitCstrOnCstr (hzArray<hzString>& ar, const char* input, const char* delim)
{
   const char* i ;
   hzString    S ;
   uint32_t    nRef = 0;
   uint32_t    nPos = 0;
   uint32_t    nLen ;
   ar.Clear() ;
   if (!input || !input[0])return E_ARGUMENT ;
   if (!delim || !delim[0])return E_ARGUMENT ;
   nLen = strlen(delim) ;
   for (i = input ;;)
   {
       if (*i == 0)
       {
           if (nPos > nRef)
           {
               S.SetValue(input + nRef, nPos - nRef) ;
           }
           ar.Add(S) ;
           break ;
       }
       if (*i == delim[0])
       {
           if (CstrCompare(i, delim))
           {
               if (nPos > nRef)
               {
                   S.SetValue(input + nRef, nPos - nRef) ;
               }
               ar.Add(S) ;
               S.Clear() ;
               nRef = nPos + nLen ;
               i += nLen ;
               nPos += nLen ;
               continue ;
           }
       }
       i++ ; nPos++ ;
   }
   return E_OK ;
}