Return Type | Function name | Arguments |
---|---|---|
hzEcode | SplitCstrOnCstr | (hzArray<hzString>&,const char*,const char*,) |
Declared in file: hzTextproc.h
Defined in file : hzTextproc.cpp
Function Logic:
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 ; }