Return to Snippet

Revision: 23827
at February 14, 2010 18:45 by desmond54


Initial Code
String.prototype.trim = function() {
// skip leading and trailing whitespace
// and return everything in between
var trimmedString = this;
trimmedString = trimmedString.replace(/^\s+/,"");
trimmedString = trimmedString.replace(/\s+$/,"");
return trimmedString;
}

Initial URL

                                

Initial Description

                                

Initial Title
Trim String Prototype

Initial Tags
javascript

Initial Language
JavaScript