Replaces real values with thier escape sequences where approapriate. Eg "Hello" on one line followed by "World" on another will become "Hello\nWorld".
| Return Type | Function name | Arguments |
|---|---|---|
| hzString | EnEscape | (hzString&,) |
Declared in file: hzTextproc.h
Defined in file : hzTextproc.cpp
Function Logic:
Function body:
hzString EnEscape (hzString& x)
{
// Category: Text Processing
//
// Replaces real values with thier escape sequences where approapriate. Eg "Hello" on one line followed by
// "World" on another will become "Hello\nWorld".
//
// Arguments: 1) x Input string
//
// Returns: Instance of hzString by value being the escaped translation of the supplied string
_hzfunc(__func__) ;
hzChain ult ; // Working chain
const char* i ; // Input string iterator
hzString result ; // Output string
if (!x.Length())
return result ;
for (i = *x ; *i ; i++)
{
if (*i == CHAR_CR) { ult.AddByte(CHAR_BKSLASH) ; ult.AddByte(''r'');continue ; }
if (*i == CHAR_NL) { ult.AddByte(CHAR_BKSLASH) ; ult.AddByte(''n'');continue ; }
if (*i == CHAR_TAB) { ult.AddByte(CHAR_BKSLASH) ; ult.AddByte(''t'');continue ; }
if (*i < 27)
{
ult.AddByte(CHAR_HAT) ;
ult.AddByte((*i + ''A'')-1);
continue ;
}
ult.AddByte(*i) ;
}
result = ult ;
return result ;
}