Skip to content

Utils / hasChinese

Function: hasChinese() ​

hasChinese(str: string): boolean

判断字符串中是否包含汉字

Parameters ​

ParameterTypeDescription
strstring字符串内容

Returns ​

boolean

Example ​

ts
hasChinese('你好')  // => true
hasChinese('Hello')  // => false
hasChinese('hi, 你好') // => true

MIT Licensed