问题
Possible Duplicate:
How do I split this string with javascript?
I want to split a comma separated string with JavaScript. How?
回答1:
var partsOfStr = str.split(',');
split()
回答2:
var array = string.split(',')
and good morning, too, since I have to type 30 chars ...
回答3:
var result;
result = "1,2,3".split(",");
console.log(result);
More info on W3Schools describing the String Split function.
回答4:
Use
YourCommaSeparatedString.split(',');
来源:https://stackoverflow.com/questions/5269856/how-to-split-comma-separated-string-using-javascript