去掉左右空格
function trim(str){
return str.replace(/(^\s*)|(\s*$)/g, "");
}
去掉所有空格
function trim(str, true){
return str.replace(/\s/g,"");