Tag: trim

  • Remove side space in string

    Javascript Trim Functions Use the code below to make trim a method of all Strings. These are useful to place in a global Javascript file included by all your pages. String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,””); } String.prototype.ltrim = function() { return this.replace(/^\s+/,””); } String.prototype.rtrim = function() { return this.replace(/\s+$/,””); } // example of using…