Exemple #1
0
TString<T>& TString<T>::DiffCat(const T *pStart, const T *pEnd)
{
	_ASSERT(pBuf && pStart && pEnd);
	int StrLen = pEnd - pStart;
	SetAllocSize(nBufSize + StrLen);
	My_strncpy(GetBuffer() + GetLen(), pStart, StrLen);
	ReleaseBuffer(nBufSize + StrLen - 1);
	return *this;
}
Exemple #2
0
TString<T> TString<T>::SubStr(int nIndex, int nCount) const
{
    _ASSERT(nIndex >= 0 && nCount >= 0);
    TString<T> Result;
    if (nIndex < GetLen())
    {
        My_strncpy(Result.GetBuffer(nCount), &pBuf[nIndex], nCount);
        Result.ReleaseBuffer();
    } else
    {
        Result.GetBuffer(1)[0] = '\0';
        Result.ReleaseBuffer(0);
    }
    return Result;
}