Posted By

2ndboy on 07/25/06


Tagged

javascript


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

Roshambo
mate
nutella


去除字符串首尾的空格


 / Published in: JavaScript
 

  1. String.prototype.trim = function()
  2. {
  3. return this.replace( /(^\s*)|(\s*$)/g, "" );
  4. }

Report this snippet  

You need to login to post a comment.