Created
March 11, 2016 10:06
-
-
Save mickeyl/d266e567da2e3af2ac0b to your computer and use it in GitHub Desktop.
A taste of Python in Objective-C
This file contains hidden or 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
@implementation NSString (IndexedSubscripting) | |
-(NSString*)objectAtIndexedSubscript:(NSInteger)index | |
{ | |
NSRange range = NSMakeRange( index < 0 ? self.length + index: index, 1 ); | |
return [self substringWithRange:range]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment