字符串去掉所有空格"abc 123 def".replace(/\s/g, "")字符串去掉左右两端空格" abc 123 def ".replace(/(^\s*)|(\s*$)/g, "");字符串去掉左边空格" abc 123 def ".replace(/(^\s*)/g,"");字符串去掉右边空格" abc 123 def ".replace(/(\s*$)/g,"");