Validate name, username, and email
Setup: How to add a Git repository to your Xcode project
Usage:
let string = " \n\t abc123 ".strip() // => "abc123"
string.isAlphanumeric // => true
"j_s".isAlphanumeric // => false
"0123".isNumeric // => true
"1E3".isNumeric // => false
let firstName = "John"
let lastName = "Smith"
let username = "johnsmith"
let email = "[email protected]"
let code = "1234"
if !firstName.isValidName {
print(Validator.invalidFirstNameMessage)
}
if !lastName.isValidName {
print(Validator.invalidLastNameMessage)
}
if !username.isValidUsername {
print(Validator.invalidUsernameMessage)
}
if !email.isValidEmail {
print(Validator.invalidEmailMessage)
}
if !code.isValidCode {
print(Validator.invalidCodeMessage)
}
Released under the Unlicense.