В этом коде я читаю файл txt: этот файл txt содержит информацию таким образом: один # два # три # четыре # пять; один # два # три # четыре # пять;
- (void) readFile{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"File.txt"];
NSString *fileString = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:NULL];
if (!fileString) {
NSLog(@"Error reading file.");
}
NSMutableArray *itemDB = [[fileString componentsSeparatedByString:@";"] mutableCopy];
[itemDB removeLastObject];
NSMutableArray *returnArray = [[NSMutableArray alloc] init];
for (int i = 0; i<[itemDB count]; i++) {
NSArray *datiItemDB = [[itemDB objectAtIndex:i] componentsSeparatedByString:@"#"];
[returnArray addObject: datiItemDB];
}
one = [[NSMutableArray alloc] initWithArray:(NSArray*)returnArray];
[returnArray release];
}
результат nslog этого массива равен
2011-07-04 10:01:16.847 Project[254:707] array one:(
(
"(\n 0,\n 1,\n 12,\n \"2011-07-04 08:00:41 +0000\",\n \"2011-07-15 00:00:00 +0000\",\n \"\",\n 0,\n 0,\n (\n ),\n \"\"\n)"
)
)
, но я хочу, чтобы результат nslog был
2011-07-04 09:52:07.281 Project[230:707] array one:(
(
0,
1,
1,
"2011-07-04 07:45:15 +0000",
"2011-07-04 07:45:15 +0000",
"",
0,
0,
(
),
""
)
)
Почему у меня есть символы "/ n" и как я могу его удалитьиз моего массива?