如何使用JavaScript拆分逗号分隔的字符串?

use*_*802 215 javascript

可能重复:
如何使用javascript分割此字符串?

我想用JavaScript分割逗号分隔的字符串.怎么样?

ale*_*lex 318

var partsOfStr = str.split(',');
Run Code Online (Sandbox Code Playgroud)

split()

  • @Andrew这是一个完全不同的问题.请再读一遍. (2认同)

tho*_*mas 109

var array = string.split(',')
Run Code Online (Sandbox Code Playgroud)

早上好,因为我要打30个字符......


Ral*_*ine 96

var result;
result = "1,2,3".split(","); 
console.log(result);
Run Code Online (Sandbox Code Playgroud)

有关描述字符串分割功能的W3Schools的更多信息.


Clo*_*ble 28

使用

YourCommaSeparatedString.split(',');
Run Code Online (Sandbox Code Playgroud)