Email & Phone Validation in Swift

后端 未结 21 1772
长发绾君心
长发绾君心 2020-12-07 12:02

i am using the following code for phone number validation. But i am getting the following error. I cant able to proceed further. Help us to take it forward.

         


        
21条回答
  •  攒了一身酷
    2020-12-07 12:40

    Phone regex only for ّIran phone number

    func isValidPhone(phone: String) -> Bool {
    
            let PHONE_REGEX = "^09[0-9'@s]{9,9}$"
            let phoneTest = NSPredicate(format: "SELF MATCHES %@", PHONE_REGEX)
            let result =  phoneTest.evaluate(with: phone)
            return result
    
        }
    

提交回复
热议问题