Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

split Method (JavaScript)

Returns the array of strings that results when a string is separated into substrings.

stringObj.split([separator[, limit]])
stringObj

Required. The String object or literal to be split. This object is not modified by the split method.

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.

The result of the split method is an array of strings split at each point where separator occurs in stringObj. The separator is not returned as part of any array element.

The following example illustrates the use of the split method.

function SplitDemo(){
   var s = "The quick brown fox jumps over the lazy dog.";
   // Split at each space character.
   var ss = s.split(" ");
   return(ss);
}

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards. See Version Information.

Applies To: String Object (JavaScript)

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.