Last active
January 21, 2019 10:05
-
-
Save youngshook/239aa66643a36c7450ea690f311bf7d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// check the name is between 4 and 16 characters | |
if !(4...16 ~= name.characters.count) { | |
return false | |
} | |
// check that name doesn't contain whitespace or newline characters | |
let range = name.rangeOfCharacterFromSet(.whitespaceAndNewlineCharacterSet()) | |
if let range = range where range.startIndex != range.endIndex { | |
return false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment