JavaScript tutorial-String object split method

JavaScript String object: split method

The split([separator]) method is used to split a string to many substrings by separating the string according to the separator specified. In the example below, we split the "I like JavaScript." string in to three different substrins-"I", "like", and "JavaScript.". The separator used in this example is a space character.


<title>Using split() method</title>

<script language="JavaScript" type="text/javascript">

var Mystr="I like JavaScript.";
var Arrstr=Mystr.split(' ');
var i;




This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.