Swift判断字符串中是否含有中文
2019-05-30 本文已影响0人
飞羽_ifeiyv
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)