Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个字符串喜欢下面
a_b_c_d
我希望将其解码为数组 t as
t[0]->a t[1]->b t[2]->c t[3]->d
只是想知道是否有javascript的ia函数可以直接解析字符串。
var string = "a_b_c_d"; var t = string.split('_');
DEMO FIDDLE
只需拆分字符串
var t = "a_b_c_d".split("_");