NSString *path = [[NSBundle mainBundle] pathForResource:@"test2" ofType:@"txt"];
NSString *string = [[NSString alloc] initWithContentsOfFile:path encoding:NSASCIIStringEncoding error:NULL];
NSArray *lines = [string componentsSeparatedByString:@"\n"]; // each line, adjust character for line endings
NSEnumerator *nse = [lines objectEnumerator];
NSMutableArray *values = [NSMutableArray new];
NSString *tmp;
while(tmp = [nse nextObject])
{
NSArray *chunks = [tmp componentsSeparatedByString: @","];
NSEnumerator *nse2 = [chunks objectEnumerator];
NSString *tmp2;
while(tmp2 = [nse2 nextObject]){
NSLog(@"%@",tmp2);
}
NSLog(@"%@", tmp);
}
No comments:
Post a Comment