Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 817 Bytes

README.md

File metadata and controls

42 lines (30 loc) · 817 Bytes

Validator

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
let firstName = "John"
let lastName = "Smith"
let username = "johnsmith"
let email = "[email protected]"

if !firstName.isValidName {
    print(Validator.invalidFirstNameMessage)
}

if !lastName.isValidName {
    print(Validator.invalidLastNameMessage)
}

if !username.isValidUsername {
    print(Validator.invalidUsernameMessage)
}

if !email.isValidEmail {
    print(Validator.invalidEmailMessage)
}

Released under the Unlicense.