Skip to content

Instantly share code, notes, and snippets.

@Olical
Created April 1, 2011 09:31
Show Gist options
  • Save Olical/897945 to your computer and use it in GitHub Desktop.
Save Olical/897945 to your computer and use it in GitHub Desktop.
Adds a trim function to strings
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
};
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment