java - Reading, parsing and sorting data from a CSV file -
i need read in csv file, parse , sort value according these parameter:
- the top 10 selling products
- the top performing branches
- the worst performing branches
- the employee took sales
here code far, advice on how sort it?
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 comma if comma has zero, or number of quotes in ahead of it. (string item : dataarray) { system.out.print(dataarray[34] + " # "); } system.out.println(); // print data line. data = csvfile.readline(); // read next line of data. } } system.out.println(); // end printout blank line. } }
Comments
Post a Comment