Skip to content

Instantly share code, notes, and snippets.

@hehongwei44
Created July 3, 2014 06:31
Show Gist options
  • Save hehongwei44/abeec850e6ff5134da9d to your computer and use it in GitHub Desktop.
Save hehongwei44/abeec850e6ff5134da9d to your computer and use it in GitHub Desktop.
判断输入的字符是否全部是中文字符
/**
*
* @descrition: 测试给定的参数是否全部为中文字符,如"中test"不会通过 。
* @param->str : 传入的参数,类型为字符串。
* @return : true表示全部为中文,false为不全是中文,或没有中文。
*
*/
var isChinese = function (str) {
var pattern = /^[\u0391-\uFFE5]+$/g;
return pattern.test(str);
}
@towry
Copy link

towry commented Jun 15, 2020

苏⼩⾈

copy the above string, not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment