String Extension Methods
JavaScript
//usage: var str = " somestring ".trim();
//output: "somestring"
//Credits to http://blog.stevenlevithan.com/archives/faster-trim-javascript
String.prototype.trim = function () {
return this.replace(/^\s\s*/, "").replace(/\s\s*$/, "");
};