Revision: 17476
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 6, 2009 21:19 by enchance
Initial Code
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } String.prototype.ltrim = function() { return this.replace(/^\s+/g,""); } String.prototype.rtrim = function() { return this.replace(/\s+$/g,""); } // Usage: var test = " Test "; var test1 = test.ltrim(); // returns "Test " var test2 = test.rtrim(); // returns " Test" var test3 = test.trim(); // returns "Test"
Initial URL
Initial Description
Initial Title
Removes unnecessary whitespace
Initial Tags
Initial Language
JavaScript