Created
July 3, 2014 06:31
-
-
Save hehongwei44/abeec850e6ff5134da9d to your computer and use it in GitHub Desktop.
判断输入的字符是否全部是中文字符
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @descrition: 测试给定的参数是否全部为中文字符,如"中test"不会通过 。 | |
* @param->str : 传入的参数,类型为字符串。 | |
* @return : true表示全部为中文,false为不全是中文,或没有中文。 | |
* | |
*/ | |
var isChinese = function (str) { | |
var pattern = /^[\u0391-\uFFE5]+$/g; | |
return pattern.test(str); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
copy the above string, not working.