JavaScript 去前后全脚半脚空格的正则

578 查看

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