Definition and Usage
The split() method is used to split a string into an array of substrings, and returns the new array.
Tip: If an empty string ("") is used as the separator, the string is split between each character.
Note: The split() method does not change the original string.
Syntax:
string.split(separator, limit)
Parameter Values
Parameter | Description |
---|
separator | Optional. Specifies the character, or the regular expression, to use for splitting the string. If omitted, the entire string will be returned (an array with only one item) |
limit | Optional. An integer that specifies the number of splits, items after the split limit will not be included in the array |
Example:
Process.a = new String([10, 205, 210, 250, 280, 300, 305, 310, 40]);
Process.E = Process.a.split(',');
Process.C = Process.E[1];
Process.D = 5 + ~~C;
By ElwynnMartin
Load an array in particular sequence
JavaScript String split() Method