Created
October 10, 2015 03:43
-
-
Save jaminguy/9d331f09b659d6fbe838 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
extension String { | |
subscript (i: Int) -> Character { | |
return self[self.startIndex.advancedBy(i)] | |
} | |
subscript (i: Int) -> String { | |
return String(self[i] as Character) | |
} | |
subscript (r: Range<Int>) -> String { | |
return substringWithRange(Range(start: startIndex.advancedBy(r.startIndex), end: startIndex.advancedBy(r.endIndex))) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment