如何使用iPhone SDK 3.0将数据导出到csv文件? [英] How to export data to a csv file with iPhone SDK 3.0?

查看:127
本文介绍了如何使用iPhone SDK 3.0将数据导出到csv文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序有一个功能,可以导出一些数据到csv文件,然后复制到PC。我不知道什么api用于实现此功能。有没有人知道这个?提前感谢。

My application has a function which can export some data to a csv file, and then copied to PC. I am not sure what api to use to implement this function. Does anyone know about this? Thanks in advance.

推荐答案

您也可以执行以下操作:

You can also do something like:

[[array componentsJoinedByString:@","] writeToFile:@"components.csv" atomically:YES encoding:NSUTF8StringEncoding error:NULL];

您可以使用这种方法的组合将CSV合并(将一个数组的输出

You can use combinations of this to put together a CSV (append the output of one array for the column names to one array for the values, etc).

当然,你必须小心地在已经包含逗号的值的前后加上引号,然后转义任何值的引号。

Of course, you have to be careful to put quotes around values that already contain a comma, and to then escape any quotes in the value.

这篇关于如何使用iPhone SDK 3.0将数据导出到csv文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆