Follow in Twitter & Facebook


Like in Facebook

Powered By Blogger Widgets

Free Download

FREE Tools


Saturday, September 8, 2012

Split javascript string

In this article we will discuss about how to split a JavaScript string. You can check the last article on Remove HTML tags from string in C#.

Here is the string:

var strMainString = new String();

strMainString = "SharePointDotNet.com|EnjoySharePoint.com|Fewlines4Biju.com";
Now we can split the string with separator "|" and we will store in an array.

var arr = new Array();

arr = myString.split("|");

Now we can retrieve the items from the array by using a for loop statement like below:

for(var i=0; i < arr.length; i++)  
{
alert ( arr[i] );
}

You can also check another article on Check if string contains a particular string in C#.Net.




0 on: "Split javascript string"