Posted By

Mithun on 11/03/09


Tagged

javascript trim white space String regular Expression


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Mithun


Trim string white spaces using regular expressions


 / Published in: JavaScript
 

  1. trimWS = function(str) {
  2. str = str.replace(/^\s*/, "");
  3. str = str.replace(/\s*$/, "");
  4. return str;
  5. },

Report this snippet  

You need to login to post a comment.