摘要: //去除字符串前后的空格 function trim(str) { if (str && typeof str === "string") { return str.replace(/(^\s*)|(\s*)$/g,""); //去除前后空白符 } } str1 = ' hello world '; console.log(trim(str1)); ... 阅读全文
posted @ 2017-07-14 10:53 gq_orange 阅读(220) 评论(0) 推荐(0) 编辑