Skip to content

Instantly share code, notes, and snippets.

View exPHAT's full-sized avatar
💬
typing...

Aaron Taylor exPHAT

💬
typing...
View GitHub Profile
@exPHAT
exPHAT / slice.swift
Last active August 29, 2015 14:02
A simple subscript to allow python-like string slicing.
// Example: mystring[0] or mystring[2,6]
import Cocoa
extension String {
subscript(index:Int) -> Character {
get {
return Character(bridgeToObjectiveC().substringWithRange(NSMakeRange(index,1)))
}
}