为String类型添加一个去除空格的方法
//定义该方法
String.prototype.Trim = function()
{
return this.replace(/(^\s*)|(\s*$)/g,"");
}

//调用函数
function test()
{
var name=" yang bo  ";
alert(name.Trim());//调用该方法
}

test();

相关文章:

  • 2021-10-12
  • 2021-08-03
  • 2021-11-30
  • 2022-12-23
  • 2022-01-14
  • 2021-11-13
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-24
  • 2021-05-23
  • 2021-06-16
  • 2021-08-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案