给出如下字符串:
"The dog has a long tail, and it is RED!"
什么样的jQuery或JavaScript魔法可用于将空间最多只保留一个空间?
目标:
"The dog has a long tail, and it is RED!"
我怎样才能更换,例如:
" "
" "
" "
" "
Run Code Online (Sandbox Code Playgroud)
同
" "
Run Code Online (Sandbox Code Playgroud)
如何使用正则表达式将所有空白字符替换为单个空字符?