The code is as follows: |
Copy code |
String str = "0123456789 "; Console. WriteLine (str. Remove (5 )); Console. WriteLine (str. Remove (5, 1 ));
|
Instance
Remove ()
Deletes a specified number of characters from a specified position.
The code is as follows: |
Copy code |
<% String str1 = "I am one of the fans of Transformers "; Response. Write (str1.Remove (6, 4); // The result is "I am one of Transformers" %> |
Use remove to remove a project from array. The Project Index is automatically reduced by 1.
In Firefox, if the item parameter is set to undefined when you call remove, the first project with the undefined value is removed. In other browsers, the item parameter with the undefined value has no effect.
The following example shows how to use remove.
JavaScript
The code is as follows: |
Copy code |
Var a = ['A', 'B', 'C', 'D', 'E']; Array. remove (a, 'C '); // Return result: "a, B, d, e" Document. write (a, "</p> "); Array. removeAt (a, 2 ); // Return result // View the results: "a, B, e" Document. write (a, "</p> ");
|