在javascript中怎么去掉字符串前后的空格

2025-06-25 07:24:11
推荐回答(1个)
回答1:

String.prototype.trim=function()
{
return this.replace(/(^\s*)|(\s*$)/g, ”);
}
然后调用trim