现在的位置: 首页 > 综合 > 正文

trim的使用 javaScript

2014年01月01日 ⁄ 综合 ⁄ 共 148字 ⁄ 字号 评论关闭

String.prototype.trim = function()
{
return this.replace(/(^/s*)|(/s*$)/g, '');  

}

   function trim(str)

{

 

   return String(str).replace(/(^/s*)|(/s*$)/g,"");

}

抱歉!评论已关闭.