js有中文英文逗号的字符串怎么分割成数组
var str="a,吧,才,的,额,飞,d";var str = str.replace(/[\uff0c]/g, ",");console.log(str);var strs = str.split(',');console.log(strs);str结果:a,吧,才,的,额,飞,d strs结果:["a", "吧", "才", "的", "额", "飞", "d"]
本文共 258 字,大约阅读时间需要 1 分钟。
var str="a,吧,才,的,额,飞,d";var str = str.replace(/[\uff0c]/g, ",");console.log(str);var strs = str.split(',');console.log(strs);str结果:a,吧,才,的,额,飞,d strs结果:["a", "吧", "才", "的", "额", "飞", "d"]
转载于:https://my.oschina.net/lixiaoyan/blog/1510453