例如将字符串ab cd ef gh ij变为ab cd ef gh ij
有这方面的正则表达式吗?
3 个解决方案
#1
"ab cd ef gh ij".replace(/\s\s/g, " ");
#2
alert("ab cd ef gh ij".replace(/\s\s+/g, " "));
#3
非常感谢两位!!
#1
"ab cd ef gh ij".replace(/\s\s/g, " ");
#2
alert("ab cd ef gh ij".replace(/\s\s+/g, " "));
#3
非常感谢两位!!