String.split()

JavaScript1.1+, JScript1.0+, ECMAScript1.0+ NES2+, Nav3+, IE3+, Opera3+ Syntax

							string.split(separator,
							num)

string.split(separator)

string.split(regexpression,
							num)

string.split(regexpression)

Description

The split() method of an instance of the String object splits the string in which it is invoked into separate strings based on the regular expression or separator passed to the method. If a regular expression is passed, it is made up of a pattern and flags that dictate what is to be matched. The separator is a string or character that is matched to perform the separation.

Note

If the LANGUAGE attribute of the <script> tag is set to "JavaScript1.2" when using the second syntactical definition and the separator is a space, ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.