判断是否包含字母let string = "输入检测字符"; for char in string.utf8 { if (char > 64 && char < 91) || (char > 96 && char < 123) { print("字符串中包含字母") break; } }