I use code as below to read text file, this file is end with "0x0A0x0D" of all lines. I have to remove null line because newlineCharacterSet can only konw one of "0x0A0x0D", do you have any idea to simple reading text file?
Code:
NSString *contents = [NSString stringWithContentsOfFile:filePath encoding:NSShiftJISStringEncoding error:nil];
list = [NSMutableArray arrayWithArray:[contents componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]];
int count = [list count];
for (int i = count - 1; i >= 0; i--) {
if ([[list objectAtIndex:i] length] == 0) {
[list removeObjectAtIndex:i];
}
}