2013-04-14 3 views
0

Voici mon code et le fichier csv est
« Bonjour, bébé », Test
ByeBye, Test
iOS lire le fichier CSV en utilisant CHCSVParser

Quand j'imprimer le rowArray, je trouve que la résultat contient "
« Bonjour, bébé »

Comment puis-je enlever

- (IBAction)importToDatabase:(id)sender { 
    NSString *csvFilePath = [NSString stringWithFormat:@"%@/Documents/%@",NSHomeDirectory(),@"test1.csv"]; 
    if([[NSFileManager defaultManager] fileExistsAtPath:csvFilePath]) 
     NSLog(@"Exist"); 
    else 
     NSLog(@"NOT EXIST"); 
    NSArray *rowArray = [NSArray arrayWithContentsOfCSVFile:csvFilePath]; 
    NSLog(@"%@",[[rowArray objectAtIndex:0]objectAtIndex:0]); 

} 

Répondre

0

Vous pouvez utiliser la fonction stringByReplacingOccurrencesOfString:withString: pour remplacer le " par une chaîne vide (voir le documentation). Si vous avez accès au code de la méthode arrayWithContentsOfCSVFile: vous pouvez le faire ici, sinon vous devrez itérer jeter les valeurs de votre tableau pour l'enlever.