CString::Delete

int Delete( int nIndex, int nCount = 1 )
throw( CMemoryException );

Return Value

The length of the changed string.

Parameters

nIndex

The index of the first character to delete.

nCount

The number of characters to be removed.

Remarks

Call this member function to delete a character or characters from a string starting with the character at nIndex. If nCount is longer than the string, the remainder of the string will be removed.

Example

//The following example demonstrates the use of CString::Delete.
   str2 = "Hockey is best!";
   printf("Before: %s\n", (LPCTSTR) str2);
   int n = str2.Delete(6, 3);
   printf("After: %s\n", (LPCTSTR) str2);
   ASSERT(n == str2.GetLength());

//this code generates this line of output:

Before: Hockey is best!
After: Hockey best!

CString OverviewClass MembersHierarchy Chart

See Also   CString::Insert