Posted By

kayue on 06/30/09


Tagged

trim


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

kayue
Alexw


Javascript Trim (String.prototype.trim)


 / Published in: JavaScript
 

remove space at the front and the end.

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

Report this snippet  

You need to login to post a comment.