Skip to content

Instantly share code, notes, and snippets.

@alvin2ye
Created September 8, 2009 08:35
Show Gist options
  • Save alvin2ye/182793 to your computer and use it in GitHub Desktop.
Save alvin2ye/182793 to your computer and use it in GitHub Desktop.
去空行
javascript trim
function Trim(s) {
var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);
return (m == null) ? "" : m[1];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment