IT Community - Software Programming, Web Development and Technical Support

JavaScript to split the string and store it in a Array?

This is a discussion on JavaScript to split the string and store it in a Array? within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; Hi, How to split the string and store it in an Array?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > HTML, CSS and Javascript Coding Techniques

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 05-13-2008, 02:17 AM
poornima poornima is offline
D-Web Sr.Programmer
 
Join Date: Dec 2007
Posts: 189
poornima is on a distinguished road
Smile JavaScript to split the string and store it in a Array?

Hi,
How to split the string and store it in an Array?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-13-2008, 02:28 AM
poornima poornima is offline
D-Web Sr.Programmer
 
Join Date: Dec 2007
Posts: 189
poornima is on a distinguished road
Smile Re: JavaScript to split the string and store it in a Array?

Hi,
we can use the following script to do this.
<script type="text/javascript">
function validate()
{
var str="new,star,rose,red,green,blue,yellow,Black,whi te";
var str1=new Array();
str1=str.split(",");
var i;
for(i in str1)
{
document.write(str1[i]);
document.write("<br>");
}
}
</script>
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
filter element in Javascript array Jeyaseelansarc HTML, CSS and Javascript Coding Techniques 4 02-11-2008 06:25 AM
Compare a string with String Array. oxygen C# Programming 5 12-28-2007 10:18 PM
How to pass array of string from vc++ dll to C# ? kingmaker C and C++ Programming 2 08-10-2007 04:35 AM
How to split a string by using a string usually in the c# dotnet... Archer C# Programming 1 07-25-2007 02:26 AM
How would you replace a char in string and how do you store the number of replacement vadivelanvaidyanathan Perl 1 07-17-2007 03:34 AM


All times are GMT -7. The time now is 01:58 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0