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*$)/,"");
}

 

 

 

 

相关文章:

  • 2021-08-27
  • 2022-01-30
  • 2021-08-22
  • 2022-01-12
猜你喜欢
  • 2022-12-23
  • 2021-12-21
  • 2020-01-27
  • 2018-06-07
  • 2021-12-31
相关资源
相似解决方案