/**判断是否为字母+数字*/
class func isLetterWithDigital(_ string:String) ->Bool{
let numberRegex:NSPredicate=NSPredicate(format:"SELF MATCHES %@","^.*[0-9]+.*$")
let letterRegex:NSPredicate=NSPredicate(format:"SELF MATCHES %@","^.*[A-Za-z]+.*$")
if numberRegex.evaluate(with: string) && letterRegex.evaluate(with: string){
return true
}else{
return false
}
}
网友评论