CStringT::Delete
Visual Studio 2005
Deletes a character or characters from a string starting with the character at the given index.
int Delete( int iIndex, int nCount = 1 );
Parameters
- iIndex
-
The zero-based index of the first character in the CStringT object to delete.
- nCount
-
The number of characters to be removed.
// cstringt_delete.cpp
#include <atlstr.h>
#include <stdio.h>
int main( int argc, char* argv[] )
{
//typedef CStringT< TCHAR, StrTraitATL< TCHAR > > CAtlString;
CAtlString str( "Soccer is best, but liquor is quicker!");
printf_s("Before: %s\n", (LPCTSTR) str);
int n = str.Delete(6, 3);
printf_s("After: %s\n", (LPCTSTR) str);
_ASSERT(n == str.GetLength());
return 0;
}
Output
Before: Soccer is best, but liquor is quicker! After: Soccer best, but liquor is quicker!