Instant methods: remove()

The instant method remove() removes a portion from a string operand and returns the resulting string.

Declaration

string string.remove( int32 aIndex, int32 aCount )

Parameters

aIndex

The character position within the original string indicating the first character to remove. The characters are numbered starting with index 0.

aCount

Maximal number of consecutive characters to remove.

Discussion

The remove() method removes up to aCount characters from the string, in context of which it has been called. The characters are removed starting with the character at position specified in the parameter aIndex. The method returns the new string without modifying the original string operand. For example:

var string s1 = "green blue red"; var string result = s1.remove( 6, 5 ); // result = "green red" var string result = s1.remove( -2, 7 ); // result = "blue red" var string result = s1.remove( 11, 10 ); // result = "green blue"