[JavaScript] 处理多余空格,即字符串之间只间隔一个空格
str = 'aaa bb cc dd' str.replace(/\s+/g, " ") // "aaa bb cc dd"
------------------------------------------------------------------
Always put yourself in the other's shoes.If you feel that it hurts you,it probably hurts others,too.------------------------------------------------------------------