I have implemented the module for reading the csv file
The project structure is as follows:
Project
--test_de.csv
--Folder
--Controller.h
--Controller.m
but the result shows no response. No words are added:
2014-06-19 15:32:16.817 marker[1748:60b] /var/mobile/Applications/E2B95450-429D-4777-97BE-0209522EFDEF/Documents/test_de.csv
2014-06-19 15:32:16.824 marker[1748:60b] (
)
The below is my code
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* fullPath = [paths objectAtIndex:0];
fullPath = [fullPath stringByAppendingPathComponent:@"test_de.csv"];
NSLog(@"%@", fullPath);
NSMutableArray *titleArray=[[NSMutableArray alloc]init];
NSString *fileDataString=[NSString stringWithContentsOfFile:fullPath encoding:NSUTF8StringEncoding error:nil];
NSArray *linesArray=[fileDataString componentsSeparatedByString:@"\n"];
int k=0;
for (id string in linesArray)
if(k<[linesArray count]-1){
NSString *lineString=[linesArray objectAtIndex:k];
NSLog(@"%@",lineString);
NSArray *columnArray=[lineString componentsSeparatedByString:@"\n"];
[titleArray addObject:[columnArray objectAtIndex:0]];
k++;
}
NSLog(@"%@",titleArray);