function trim(str) { return str.replace(/(^\s*)|(\s*$)/g, ""); }
转载于:https://www.cnblogs.com/yanjunwu/archive/2013/04/25/3041792.html