Swift判断字符串中是否含有中文

var str = "l我o是v中e文123456789"

func judgeStringIncludeChineseWord(string: String) -> Bool {
    
    for (_, value) in string.characters.enumerated() {

        if ("\u{4E00}" <= value  && value <= "\u{9FA5}") {
            return true
        }
    }
    
    return false
}

judgeStringIncludeChineseWord(string: str) 

你可能感兴趣的:(Swift判断字符串中是否含有中文)