标签:turn 转换 pre 分割 字符 span blog com htm
// 待转换为数组的字符串 var a = "aa,bb,cc,dd," // 分割为数组 var b = a.split(",") 输出结果:["aa", "bb", "cc", "dd", ""] // 排除b数组中的空元素 var c = b.filter(str=>{return !!str}) 输出结果:["aa", "bb", "cc", "dd"] // 整合 var d = a.split(",").filter(str=>{return !!str}) 输出结果:["aa", "bb", "cc", "dd"]
参考:https://www.cnblogs.com/lvlin241/p/13177823.html
标签:turn 转换 pre 分割 字符 span blog com htm
原文地址:https://www.cnblogs.com/jiaqi1719/p/13209516.html