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!

SliverNinja - MSFT
  • 31,051
  • 11
  • 110
  • 173
Nic Meiring
  • 882
  • 5
  • 16
  • 33

2 Answers2

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(",");
Gabe
  • 49,577
  • 28
  • 142
  • 181
  • 1
    Would the downvoter care to share the reason for down-voting, or was it out of spite? Clearly it's the correct answer. – Gabe May 11 '12 at 16:33
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(",");
Tower
  • 98,741
  • 129
  • 357
  • 507
  • it strange how the same answer but you get less upvotes as mr 10k...almost like hes getting followed by ppl and getting voted regardless – Piotr Kula May 11 '12 at 15:52
  • 1
    It's probably the "most voted up" gathers most views. After all, he answered just before I did :P – Tower May 11 '12 at 15:52
  • 3
    Yea that is strange, actually no it's NOT. I answered 2 minutes earlier. – Gabe May 11 '12 at 15:53
  • so.. same answer. both deserve the same upvotes. bot of you did the same amount of work and effor within the same time.. – Piotr Kula May 11 '12 at 15:54
  • oh -- and 9 upvotes within 10minutes of aksing a question.. are you having a laugh? – Piotr Kula May 11 '12 at 15:55
  • yea yea... it would not seem so conspicuous if the OP had received the same amount of upvotes for asking such a complicated questions..which you answered within a minute then got 9 up votes and nobody else. lol – Piotr Kula May 11 '12 at 15:57
  • omg stop the auto upvote bots already.. everything you say on this page gets upvoted.. booo – Piotr Kula May 11 '12 at 15:59
  • 4
    @ppumpkin, where's your answer? You're not entitled to upvotes for answering a question, sorry. – Gabe May 11 '12 at 16:00
  • 2
    @ppumkin You should use your efforts to answer more questions instead of moaning. – SliverNinja - MSFT May 11 '12 at 16:19
  • Look mate. I answered a bunch of question on this forum.. and it always turns out mr 10K(not him but others like whou have 50k) will get 25 upvotes for a 3 line answer wihtin 5 minutes. Where i actaully try hard to give an answer and get downvoted because i said 1 wrong word. I pledge to up vote everybody around Mr 10K's because they are greedy and dont upvote fellow question answererers – Piotr Kula May 11 '12 at 16:24
  • 3
    Everyone starts out with ZERO rep points, sorry that you're expecting it to be more of a socialist point system. – Gabe May 11 '12 at 16:32