split (RegExp - JavaScript)
Splits a string between string separators.
Parameters |
Description |
separator |
The string to be split. |
limit |
A limit on the number of splits. |
Return value |
Description |
string[] |
Substrings resulting from the splits. |
Usage
This RegExp
object is
the separator. A null or empty separator splits the string between
every character.
Examples
This example displays
Paris,Moscow,Tokyo
.
var cities = new String("Paris; Moscow; Tokyo");
var re = new RegExp("\\s*;\\s*");
re.split(cities, 16).toString()
Have feedback?
Google Analytics is used to store comments and ratings. To provide a comment or rating for a topic, click Accept All Cookies or Allow All in Cookie Preferences in the footer of this page.