javascript正则表达式 实现Trim()
javascript正则表达式 实现Trim()
String.prototype.trim = function(){
return this.replace(/(^\s*)|(\s*$)/, "");
}
TrimLeft()
String.Prototype.trimLeft=function(){
return this.replace(/(^\s*)/,"");}
trimRight()
String.prototype.trimRight()=funtion(){
return this.replace(/(\s*$)/,"");
}