Created
November 18, 2011 23:55
-
-
Save jarodl/1378143 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
#import <Foundation/Foundation.h> | |
@interface NSString (charactersAsArray) | |
- (NSArray *)charactersAsArray; | |
@end |
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
#import "NSString+charactersAsArray.h" | |
@implementation NSString (charactersAsArray) | |
- (NSArray *)charactersAsArray | |
{ | |
NSMutableArray *characters = [NSMutableArray arrayWithCapacity:[self length]]; | |
for (int i = 0; i < [self length]; i++) | |
[characters addObject:[self substringWithRange:NSMakeRange(i, 1)]]; | |
return characters; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment