Last active
October 14, 2016 10:07
-
-
Save natecook1000/d9537ae3df8e1b51e34a 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
// If we extend UnicodeScalar to conform to ForwardIndexType, we can create and map a Range. | |
extension UnicodeScalar: ForwardIndexType { | |
public func successor() -> UnicodeScalar { | |
return UnicodeScalar(value + 1) | |
} | |
} | |
let alphabet = ("A"..."Z" as Range).map { String($0) } | |
// ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment