5

I want to take this array containing one item (a STRING with a bunch of comma delimited items)

["Bucknell Venture Plan Competition, Mitch Blumenfeld, DreamIt Ventures, Deep Fork Capital, John Ason, Mitchell Blumenfeld, Gianni Martire"]

I want to turn it into this. An array containing each name as a seperate array item.

["Bucknell Venture Plan Competition", "Mitch Blumenfeld", "DreamIt Ventures", "Deep Fork Capital", "John Ason", "Mitchell Blumenfeld", "Gianni Martire"]

Thanks!

UPDATE:

Thanks for the help. That worked!

4
  • possible duplicate of how to split a string in javascript Commented May 11, 2012 at 15:57
  • Better duplicate: stackoverflow.com/questions/96428/… Commented May 11, 2012 at 16:00
  • 2
    Accept the answer, do not update your post saying it worked. Commented May 11, 2012 at 16:17
  • sorry about that. when i updated it it sitll said 5 minutes til you can upvote. forgot to come back. marked now Commented May 11, 2012 at 18:18

2 Answers 2

9

Simple as:

var myArr = ["Bucknell Venture Plan Competition, Mitch Blumenfeld, DreamIt Ventures, Deep Fork Capital, John Ason, Mitchell Blumenfeld, Gianni Martire"];
var myNewArr = myArr[0].split(",");
Sign up to request clarification or add additional context in comments.

1 Comment

Would the downvoter care to share the reason for down-voting, or was it out of spite? Clearly it's the correct answer.
5

I think this should work:

var items = ["Bucknell Venture Plan Competition, Mitch Blumenfeld, DreamIt Ventures, Deep Fork Capital, John Ason, Mitchell Blumenfeld, Gianni Martire"];
var array = items[0].split(",");

11 Comments

It's probably the "most voted up" gathers most views. After all, he answered just before I did :P
Yea that is strange, actually no it's NOT. I answered 2 minutes earlier.
@ppumpkin, where's your answer? You're not entitled to upvotes for answering a question, sorry.
@ppumkin You should use your efforts to answer more questions instead of moaning.
Everyone starts out with ZERO rep points, sorry that you're expecting it to be more of a socialist point system.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.