我需要读取一个csv文件,解析它然后根据这些参数对值进行排序:
到目前为止,这是我的代码,有关如何对其进行排序的任何建议吗?
import java.io.*;
public class CSV {
public static void main(String[] args) throws IOException {
try (BufferedReader CSVFile = new BufferedReader(new FileReader("/K:/ConnexicaWork/data/data.csv"))) {
String[] dataArray = null;
String data = CSVFile.readLine(); // Read first line.
while (data != null) {
data = data.replace(",00", ".00");
dataArray = data.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)"); //split on the comma only if that comma has zero, or an even number of quotes in ahead of it.
for (String item : dataArray) {
System.out.print(dataArray[34] + " # ");
}
System.out.println(); // Print the data line.
data = CSVFile.readLine(); // Read next line of data.
}
}
System.out.println(); // End the printout with a blank line.
}
}