string::Delete

Description

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.

Syntax

int Delete( int nIndex, int nCount = 1 )

Parameters

nIndex
[input] The index of the first character to delete.
nCount
[input] The number of characters to be removed.

Return

The length of the changed string.

Examples

EX1

void string_Delete_ex1()
{
        string str("Summer is best");
        int len = str.GetLength();
        
        int count = 3;
        int ret = str.Delete(6, count);
        if( ret == len-count )
        {
                out_str(str);// output "Summer best"  
                out_int("", ret); // 11
        }
}

Remark

See Also

string::Insert, string::Remove, string::Left, string::Right

header to Include

origin.h