function trims(str){ return str.replace(/[ ]/g,""); //去除字符串中间的空格 } 转载于:https://www.cnblogs.com/daiwenru/p/6248702.html