2012-12-20 53 views
0

各個領域:從這個代碼https://github.com/davedelong/CHCSVParser得到chcsv解析器

NSArray *a = [[NSArray alloc] initWithContentsOfCSVString:lunchFile 
                 encoding:NSUTF8StringEncoding 
                  error:&err]; 

我得到下面的數組

(
     (
     Date, 
     Item, 
     Desc 
     "price#", 
     "add#", 
     rate, 
     "", 
     "" 
    ), 
     (
     "12/10/12", 
     abc, 
     "abc equipment", 
     abc678, 
     "Y.7.A", 
     "555,007.21", 
     "", 
     "" 
    ), 

如何從每個字段值?。第一行是列名,它需要填充sqlite數據庫。我是一個noob在這如何從每個字段獲取值。我正在使用fmdb提前sqlite.db.Thanks中的字段。

回答

0

找到了:

NSArray *s1 = [a objectAtIndex:4]; 


NSLog(@" element : %@", [s1 componentsJoinedByString:@","]);  

    for (NSUInteger i = 0; i < s1.count; i++) { 
     NSString* string = [s1 objectAtIndex:i]; 
     NSLog(@" This is : %d %@",i , string); 

    }