Snippets Collections
func isValid(testStr:String) -> Bool {
    guard testStr.count > 7, testStr.count < 18 else { return false }

    let predicateTest = NSPredicate(format: "SELF MATCHES %@", "^(([^ ]?)(^[a-zA-Z].*[a-zA-Z]$)([^ ]?))$")
    return predicateTest.evaluate(with: testStr)
}
star

Wed Mar 09 2022 08:36:25 GMT+0000 (UTC) https://stackoverflow.com/questions/55181606/how-to-have-a-firstname-validation-in-ios-swift4

#ios #swift #name #validation #validate

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension