I get a remote text file with a specific number of lines. Every line has the same format, and at the end of each one it has a 0x0D(carriage return) and 0x0A(new line).
As a consecuence if I run the following code:
NSError *error = nil;
NSString *words = [[NSString alloc] initWithContentsOfFile:path
encoding:NSUTF8StringEncoding error:&error];
NSArray* lines = [words componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];
for(NSString *str in lines){
NSLog(@"%@",str);
}
I get a blank line between every text line because of those line ending characters. How would you customize my reading and read those lines without those empty ones?
You can try the following: