Skip to content

Instantly share code, notes, and snippets.

@laispace
Created July 28, 2015 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laispace/56185b5dec648bec6edc to your computer and use it in GitHub Desktop.
Save laispace/56185b5dec648bec6edc to your computer and use it in GitHub Desktop.
判断字符是否为中文
/**
* 判断置顶字符是否为中文
* @method isChinese
* @param {String} s
* @return {Boolean}
*/
isChinese: function(s) {
//4E00 - 9FA5
var code = ('' + s).charCodeAt(0);
if (code >= 0x4E00 && code <= 0x9FA5) {
return true;
} else {
return false;
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment