:
RegexKitLite required . Uses a regular expression (?s).to split a string of Unicode characters into NSArray. The regex operator .by default matches all but newline characters, and the sequence (?s)says Turn on the Dot All regex option, which .also allows you to match the newline character. This is important, as we obviously go through at least \nthe example below.
#import <Foundation/Foundation.h>
#import "RegexKitLite.h"
int main(int argc, char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
unichar uc[1024];
for(NSUInteger idx = 0UL; idx < 1024UL; idx++) { uc[idx] = (unichar)idx; }
NSArray *unicharArray = [[NSString stringWithCharacters:uc length:1024UL] componentsMatchedByRegex:@"(?s)."];
NSLog(@"array: %@", [unicharArray subarrayWithRange:NSMakeRange(32UL, (1024UL - 32UL))]);
[pool release];
return(0);
}
source
share