标签:
//删除首尾空格 var pattern = /^\s+/; //强制首 var str = ‘ goo gle ‘; var result = str.replace(pattern, ‘‘); pattern = /\s+$/; //强制尾 result = result.replace(pattern, ‘‘); alert(‘|‘ + result + ‘|‘);
类似于$.trim(str)方法
标签:
原文地址:http://www.cnblogs.com/vscss/p/5637791.html