Splits a String object into an array of strings by separating the string into substrings.
Method of String
Syntax
split( [separator][, limit] )
Parameters
Parameter | Description |
---|---|
separator | Specifies the character to use for separating the string. The separator is treated as a string. If separator is omitted, the array returned contains one element consisting of the entire string. |
limit | Integer specifying a limit on the number of splits to be found. |
Description
The split method returns the new array.
When found, separator is removed from the string and the substrings are returned in an array. If separator is omitted, the array contains one element consisting of the entire string.