Deletes a specified number of characters from this String beginning at a specified location.
[Visual Basic] Public Function Remove( _ ByVal startIndex As Integer, _ ByVal count As Integer _ ) As String [C#] public string Remove( int startIndex, int count ); [C++] public: String* Remove( int startIndex, int count ); [JScript] public function Remove( startIndex : int, count : int ) : String;
A string that consists of the number of characters removed from this instance starting at beginning point.
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | If either the index or the number of characters is less than zero. |
ArgumentOutOfRangeException | If the index and the number of characters are greater than the length of this string. |
The Remove method updates a string by removing trailing characters. The string is unchanged. As a special case, if the beginning position is equal to the length of this string and if the number of characters is zero, then a copy of this string is returned.
Note that the first location has an index of 0.
The startIndex parameter must be greater than 0 or equal to the length of this string.
The count parameter can be zero, in which case no characters are removed.