文件名称:iOS CSV文件导出,保存
文件大小:3KB
文件格式:ZIP
更新时间:2018-10-21 10:56:27
iOS,CSV, 保存,导出
iOS CSV文件导出,保存 -(void)writeDict:(NSDictionary *)dict forFirst:(BOOL)first{ NSMutableString *str = [NSMutableString string]; //第一次写入字典的key值 if (first) { for (NSString *key in dict.allKeys) { //"," 换列 [str appendString:[NSString stringWithFormat:@"%@,",key]]; } } //换行 [str appendString:@"\n"]; for (NSString *value in dict.allValues) { [str appendString:[NSString stringWithFormat:@"%@,",value]]; } [self writeData:[str dataUsingEncoding:self.encode]]; isFirst = false; }
【文件预览】:
WSCSVWriter.h
WSCSVWriter.m