5

我想获取包含一个项目的这个数组(一个带有一堆逗号分隔项目的字符串

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

我想把它变成这个。一个数组,包含每个名称作为单独的数组项。

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

谢谢!

更新:

谢谢您的帮助。那行得通!

4

2 回答 2

9

简单如:

var myArr = ["Bucknell Venture Plan Competition, Mitch Blumenfeld, DreamIt Ventures, Deep Fork Capital, John Ason, Mitchell Blumenfeld, Gianni Martire"];
var myNewArr = myArr[0].split(",");
于 2012-05-11T15:41:31.120 回答
5

我认为这应该有效:

var items = ["Bucknell Venture Plan Competition, Mitch Blumenfeld, DreamIt Ventures, Deep Fork Capital, John Ason, Mitchell Blumenfeld, Gianni Martire"];
var array = items[0].split(",");
于 2012-05-11T15:42:50.940 回答