Extending String object to include the trim() function

/ Published in: JavaScript
Save to your folder(s)

Copy this code and paste it in your HTML
  1. String.prototype.trim = function () {
  2. return this.replace(/^\s*/, "").replace(/\s*$/, "");
  3. }

URL: http://www.delphifaq.com/faq/f1031.shtml

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.