Поделиться через


CStringT::Delete

Deletes a character or characters from a string starting with the character at the given index.

int Delete(
   int iIndex,
   int nCount = 1
);

Параметры

  • iIndex
    The zero-based index of the first character in the CStringT object to delete.

  • nCount
    The number of characters to be removed.

Возвращаемое значение

The length of the changed string.

Заметки

If nCount is longer than the string, the remainder of the string will be removed.

Пример

// typedef CStringT<TCHAR, StrTraitATL<TCHAR, ChTraitsCRT<TCHAR>>> CAtlString;

CAtlString str(_T("Soccer is best, but liquor is quicker!"));
_tprintf_s(_T("Before: %s\n"), (LPCTSTR)str);

int n = str.Delete(6, 3);
_tprintf_s(_T("After: %s\n"), (LPCTSTR)str);
ASSERT(n == str.GetLength());

Требования

Header: cstringt.h

См. также

Основные понятия

CStringT Class

CStringT Members