Tests if a supplied string (or text at a hzChain iterator) is of the form of an domain name. Permitted chars are: [a-z], [A-Z], [0-9] and the period (.) or minus sign (-) if they are not the last character in the string.

Return TypeFunction nameArguments
boolIsDomain(const char*,)

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

Function Logic:

0:START 1:unknown 2:Return false 3:unknown 4:unknown 5:bPeriod 6:unknown 7:items 8:Return false 9:unknown 10:Return true 11:Return false

Function body:

bool IsDomain (const char* cpStr)
{
   //  Category: Text Processing
   //  
   //  Tests if a supplied string (or text at a hzChain iterator) is of the form of an domain name.
   //  
   //  Permitted chars are: [a-z], [A-Z], [0-9] and the period (.) or minus sign (-) if they are not the last character in the string.
   //  
   //  Arguments: 1) cpStr The char pointer to be tested
   //  
   //  Returns: True If the supplied cstr sets the domain name
   //     False Otherwise
   _hzfunc("IsDomain") ;
   const char* i ;                 //  Source string iterator
   uint32_t    nC = 0;         //  Char count
   bool        bPeriod = false ;   //  Confirmed period
   if (!cpStr || !cpStr[0])
       return false ;
   //  Count chars beyond @
   for (i = cpStr ; *i ; i++)
   {
       if (*i == CHAR_PERIOD)
           bPeriod = true ;
       if ((*i >&eq; ''a''&&*i <&eq; ''z'')||(*i >&eq; ''A''&&*i <&eq; ''Z'')||(*i >&eq; ''0''&&*i <&eq; ''9'')
           || (*i == CHAR_MINUS && i[1]> CHAR_SPACE && nC) || (*i == CHAR_PERIOD && i[1]> CHAR_SPACE && nC))
       {
           nC++ ;
           continue ;
       }
       return false ;
   }
   if (bPeriod && nC > 2)
       return true ;
   return false ;
}