Download
100% FREE
Office Document APIs for .NET
Online: 1211
Home
Articles
Interviews
Forums
For Beginners
Popular Questions
ITIL Career Advice
PMP Career Advice
Career Advices
Codes
Videos
ASP.NET
ASP.NET MVC
Android Intel XDK
Sql Server
AngularJS
Bootstrap
Backbone.JS
MongoDB
LESS (CSS)
jQuery
WPF
WWF
SSIS
LightSwitch
Tutorials
News
ASP.NET MVC
|
Be Interview Ready
|
Top Performers
|
DNF MVP
|
Top Posts
|
Winners
|
Subscribe
|
Bookmarks
|
Catalogs
Welcome Guest !
Register
Login
Home
>
Forums
>
JavaScript
>
Loading ...
how to split with ( ' \n ', ' ', ',' , ';' ) in javascript
Posted by
Abhi_patil
under
JavaScript
on 2/20/2009 | Views : 22414 | Status :
[Member]
| Replies : 2
Write New Post
|
Search Forums
|
Resolved Posts
|
Un Answered Posts
|
Forums Home
i want to split string with comma,space,newline,semicolon;
as like we can do in c# i.e
char[] arr={ ' \n ', ' ', ',' ,' ;' };
string[] str=str1.split(arr);
how i can do this in javascript..
please.
thank you.
Reply
|
Reply with Attachment
Alert Moderator
Responses
Posted by:
Neeks
on: 2/23/2009
[Member]
Bronze
0
<script language="javascript" type="text/javascript">
function fnSplit(strVal)
{
var data = "; , \n";
strVal = strVal.replace(";", "~"); //Here we are replacing the necessary characters with the '~' sign
alert(strVal);
strVal = strVal.replace(",", "~");//Here we are replacing the necessary characters with the '~' sign
alert(strVal);
strVal = strVal.replace("\n", "~");//Here we are replacing the necessary characters with the '~' sign
alert(strVal);
var splitArr = strVal.split("~");
var intCount = 0;
while(intCount < splitArr.length)
{
alert(splitArr[intCount]);
intCount += 1;
}
}
</script>
Abhi_patil
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
SqlDeveloper
on: 9/25/2009
[Member]
Starter
0
Please refer to article
http://www.kodyaz.com/articles/javascript-string-split-function-example.aspx
for more text splitting with js.
Abhi_patil
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Login to post response
Latest Posts
SEO(Search Engine Optimization)
(0)
New
Dial Hotmail Customer service Number +1-800-518-0963
(0)
New
Best Assignment Help Services Provider
(0)
Updated
How can a video in the website explain the navbar values?
(1)
Updated
surge arresters price
(0)
New
small hot chamber die casting machine for sale
(0)
New
Hangzhou Lin'an Tianfu non-woven
(0)
New
low price hook and loop buckle strap
(0)
New
More ...