swift 密码由6-16数字和字母组合组成

时间:2023-03-09 19:30:53
swift 密码由6-16数字和字母组合组成

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 15.0px Menlo; color: #ffffff; background-color: #282b35 }
p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 15.0px Menlo; color: #e44347; background-color: #282b35 }
p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 15.0px Menlo; color: #93c96a; background-color: #282b35 }
span.s1 { color: #c2349b }
span.s2 { color: #00afca }
span.s3 { color: #ffffff }
span.s4 { color: #e44347 }

class func isPassword(pasword : String) -> Bool {

let pwd =  "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$"

let regextestpwd = NSPredicate(format: "SELF MATCHES %@",pwd)

if (regextestpwd.evaluate(with: pasword) == true) {

return true

}else{

return false

}

}