JavaScript将逗号分割的CSV格式字符串转换成数组,只需要通过split函数按照逗号分割即可。
var str = "apple, peaches, oranges, mangoes"; //http://www.75271.com var fruitsArray = str.split(","); //print fruitsArray[0]: apple
JavaScript将逗号分割的CSV格式字符串转换成数组,只需要通过split函数按照逗号分割即可。
var str = "apple, peaches, oranges, mangoes"; //http://www.75271.com var fruitsArray = str.split(","); //print fruitsArray[0]: apple