remove (JavaScript)

Removes a substring.

Defined in

String (Standard - JavaScript)

Syntax

remove(index:int) : string

remove(index:int, count:int) : string

Parameters Description
index The starting position of the deletion. If the index is less than or equal to 0, or greater than the last index, no deletion occurs.
count The number of characters to be removed. Defaults to the end of the substring. If the count is less than or equal to 0, no deletion occurs.
Return value Description
string A copy of this string with the substring removed. This string remains as is.

Examples

(1) This example returns Paris.
cities = new String("Paris   Moscow   Tokyo");
cities.remove(5)

(2) This example creates a new string Paris Tokyo.

cities = new String("Paris   Moscow   Tokyo");
cities.remove(5, 9)