String.prototype.ltrim = function()
{
return this.replace(/(^\s*)/g, "");
}
String.prototype.rtrim = function()
{
return this.replace(/(\s*$)/g, "");
}
使用方法:
var str = " abc ";
alert(str);
alert(str.LTrim().Rtrim());
{
return this.replace(/(^\s*)/g, "");
}
String.prototype.rtrim = function()
{
return this.replace(/(\s*$)/g, "");
}
使用方法:
var str = " abc ";
alert(str);
alert(str.LTrim().Rtrim());