Skip to content

Instantly share code, notes, and snippets.

@shuizhongyueming
Created May 10, 2013 17:24
Show Gist options
  • Save shuizhongyueming/5555939 to your computer and use it in GitHub Desktop.
Save shuizhongyueming/5555939 to your computer and use it in GitHub Desktop.
JavaScript: Util checkNull
/**
* [checkNull 查看函数是否为空或者只有空格]
* @param {[string]} str [要验证的字符串]
* @return {[int]} [0,为空;1,不为空]
*/
function checkNull(str){//,是,则return 0
if(str.match(/^\s*$/g)){return 0;}
else{return 1;}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment