Splits an input chain into a series of strings on the basis of a single delimiting char. .
| Return Type | Function name | Arguments |
|---|---|---|
| void | SplitChain | (hzVect<hzString>&,hzChain&,char,) |
Declared and defined in file: hzTextproc.cpp
Function Logic:
Function body:
void SplitChain (hzVect<hzString>& ar)hzChain& input, char cDelim,
{
// Category: Text Processing
//
// Splits an input chain into a series of strings on the basis of a single delimiting char.
//
// Arguments: 1) ar The vector of strings that will be populated by this operation (note it is first cleared)
// 2) input The input string or chain
// 3) cDelim The delimitor (default of comma)
//
// Returns: None.
hzChain C ; // Temporary chain (for storing partial data)
chIter i ; // Itererator for input
hzString S ; // Set by temp chain upon delim
ar.Clear() ;
if (input.Size())
{
if (!cDelim)
cDelim = CHAR_COMMA ;
for (i = input ; !i.eof() ; i++)
{
if (*i == cDelim)
{
S = C ;
ar.Add(S) ;
C.Clear() ;
}
C.AddByte(*i) ;
}
if (C.Size())
{
S = C ;
ar.Add(S) ;
}
}
}