Last active
February 28, 2016 23:41
-
-
Save an0/a8ce827d17f55af57f62 to your computer and use it in GitHub Desktop.
A...Z
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 Character: ForwardIndexType { | |
public func successor() -> Character { | |
return Character(String(self).successor()) | |
} | |
} | |
extension String: ForwardIndexType { | |
public func successor() -> String { | |
let scalars = self.unicodeScalars | |
let scalar = scalars[scalars.startIndex] | |
let nextScalar = UnicodeScalar(scalar.value + 1) | |
return String(nextScalar) | |
} | |
} | |
let a = "a"..."z" | |
"".join(a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment