我正在申请报价。那么我可以直接在Android中从csv文件中提取数据(引号)吗?如果是,请帮助!
答案 0 :(得分:0)
是的,您可以轻松地从csv文件中写入数据,因为.csv文件是逗号分隔值文件,因此您可以通过','
分割文件来获取数据 BufferedReader reader = new BufferedReader(new InputStreamReader(csv_file));
try {
String line;
while ((line = reader.readLine()) != null) {
String[] RowData = line.split(",");
data = RowData[0];
value = RowData[1];
// do whatever you want to do with the data and value
}
}
catch (IOException ex) {
// handle exception
}
finally {
try {
csv_file.close();
}
catch (IOException e) {
// handle exception
}
}