Created
August 19, 2019 14:15
-
-
Save kocyigityunus/955c2e9fc7c0477c44fde1dbcf565342 to your computer and use it in GitHub Desktop.
CharacterSet+Extensions
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
extension CharacterSet { | |
static var alphanumericsWithSpace: CharacterSet { | |
var characterSet = CharacterSet.alphanumerics | |
characterSet.insert(charactersIn: " ") | |
return characterSet | |
} | |
static var moneyTransferLargeCharacterSet: CharacterSet { | |
var characterSet = alphanumericsWithSpace | |
characterSet.insert(charactersIn: ".,-()*+[]:;") | |
return characterSet | |
} | |
static var exampleCharacterSet: CharacterSet { | |
return CharacterSet(charactersIn: "ExampleCharacterSet") | |
} | |
static var unionAndIntersectionCharacterSet: CharacterSet { | |
return alphanumerics | |
.union(.whitespacesAndNewlines) | |
.intersection(.decimalDigits) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment