Javascript Trim
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };
DZone Snippets > Will_Rickards > trim
12390 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Will Rickards http://willrickards.net/
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };