Skip to content

Instantly share code, notes, and snippets.

@furf
Created May 7, 2009 16:04
Show Gist options
  • Save furf/108182 to your computer and use it in GitHub Desktop.
Save furf/108182 to your computer and use it in GitHub Desktop.
function trim(str){
var start = -1,
end = str.length;
while(str.charCodeAt(--end) < 33);
while(str.charCodeAt(++start) < 33);
return str.slice(start, end + 1);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment