Skip to content

Instantly share code, notes, and snippets.

@PeterRao
Last active December 26, 2015 04:59
Show Gist options
  • Save PeterRao/7096959 to your computer and use it in GitHub Desktop.
Save PeterRao/7096959 to your computer and use it in GitHub Desktop.
正则表达式去除首尾空格
var trim = function(s){
return s.replace(/(^\s*)|(\s*$)/g, "");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment