Returns the array of strings that results when a string is separated into substrings.
|
---|
function split([ separator : { String | RegExp } [, limit : Number]]) : Array |
Arguments
- separator
-
Optional. A string or an instance of a Regular Expression object identifying one or more characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.
- limit
-
Optional. A value used to limit the number of elements returned in the array.
Remarks
Example
The following example illustrates the use of the split method.
В | Copy Code |
---|
function SplitDemo(){
var s, ss;
var s = "The rain in Spain falls mainly in the plain.";
// Split at each space character.
ss = s.split(" ");
return(ss);
} |
Requirements
See Also