Conditional, content based truncation. If the supplied patern exists in the string, the new string will be everything upto but not including the first instance of the patern. If the pattern is empty or does not exist in the string, the string content will be unchanged.

Return TypeFunction nameArguments
hzString&hzString::TruncateUpto(const char*,)

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

Function Logic:

0:START 1:unknown 2:Return *this 3:unknown 4:Return *this 5:thisCtl i j 6:unknown 7:Return *this 8:unknown 9:Return Truncate(nLen)

Function body:

hzString& hzString::TruncateUpto (const char* patern)
{
   //  Category: Text Processing
   //  
   //  Conditional, content based truncation. If the supplied patern exists in the string, the new string will be everything upto but not including the first
   //  instance of the patern. If the pattern is empty or does not exist in the string, the string content will be unchanged.
   //  
   //  Arguments: 1) pattern The pattern at which the string will be truncated.
   //  Returns: Reference to this string in all cases
   _hzfunc("hzString::TruncateUpto") ;
   _strItem*       thisCtl ;   //  This string's control area
   const char*     i ;         //  Pointer into string data
   const char*     j ;         //  Pointer to patern instance
   uint32_t        nLen ;      //  Number of bytes from start of existing string to patern instance
   //  If no pattern supplied, do nothing
   if (!patern || !patern[0])
       return *this ;
   //  If NULL return
   if (!m_addr)
       return *this ;
   thisCtl = _strXlate(m_addr) ;
   //  Test if change required
   i = (char*) thisCtl->_data() ;
   j = strstr(i, patern) ;
   if (!j)
       return *this ;
   for (nLen = 0; i != j ; i++, nLen++) ;
   return Truncate(nLen) ;
}