JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 3rd, 2005, 03:14 AM
hominid hominid is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 2 hominid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 8 sec
Reputation Power: 0
Question Beginner help

Hi. I'm working on a problem to take a list from a prompt, each item seperated by by a comma and a space, and use a method to convert the listed items into an array, removing the comma and space delimiters. I'm using the split() method to put the list items into an array, but I can't find any documentation on how to remove the comma and space. Could someone point me in the right direction? I'm not looking for someone to give me the code to do it, just something like, "Use ____ and a loop" or something. Thanks.

Reply With Quote
  #2  
Old April 3rd, 2005, 11:05 AM
Anibal Anibal is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 176 Anibal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 4 h 20 m 48 sec
Reputation Power: 4
Hey mominid!

The Split method removes the comma and space (or the delimiter you suply to it)
Example:
var numbers = '1,2,3,4,5';
var arrayNumbers = split(numbers, ',');

now
arrayNumbers[0] = 1
arrayNumbers[1] = 2
arrayNumbers[2] = 3
......
......
......

Good Luck!

ANibal.

PS: arrayNumbers.length will give you the amount of elements in the array!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Beginner help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway