1、  去掉字符串前后所有空格:

代码如下:

function Trim(str)
 { 
  return str.replace(/(^\s*)|(\s*$)/g, ""); 
}
View Code

 

相关文章: