js去除中间空格
function Trim(his){
var str,begin_str,end_str,result;
//找到字符串开始位置
Pos_Start = -1;
for(var i=0;i<his.length;i++){
if(his.charAt(i)!=" "){
Pos_Start = i;
break;
}
}
//找到字符串结束位置
Pos_End = -1;
for(var i=his.length-1;i>=0;i--){
if(his.charAt(i)!=" "){
Pos_End = i;
break;
}
}
str=his.substring(Pos_Start,Pos_End);
begin_str=his.substring(0,Pos_Start);
end_str=his.substring(Pos_End,his.length);
var reg=/\s+/g;
result =begin_str+str.replace(reg,'')+end_str;
return result;
}