gerlounge.blogg.se

Notepad++ sort column by length
Notepad++ sort column by length












Step 8 : Create BufferedWriter object to write the records into output text file.īufferedWriter writer = new BufferedWriter(new FileWriter(“Pass the file location here”)) Step 7 : Sort the ArrayList studentRecords using Collections.sort() method by passing either nameCompare or marksCompare object depending upon on which field you want to sort the text file.Ĭollections.sort(studentRecords, new marksCompare()) StudentRecords.add(new Student(name, marks)) Int marks = Integer.valueOf(studentDetail) String studentDetail = currentLine.split(” “) For each student record, create one Student object and add that Student object into studentRecords. Step 6 : Read every student record from input text file.

notepad++ sort column by length

Step 5 : Create an ArrayList to hold the Student objects.ĪrrayList studentRecords = new ArrayList() Step 4 : Create BufferedReader object to read the input text file.īufferedReader reader = new BufferedReader(new FileReader(“Pass The File Location Here”)) Writer = new BufferedWriter(new FileWriter("C:\\output.txt")) Creating BufferedWriter object to write into output file

notepad++ sort column by length

Reading all the lines of input file one by one and adding them into ArrayList Reader = new BufferedReader(new FileReader("C:\\input.txt")) Creating BufferedReader object to read the input file

notepad++ sort column by length

Create an ArrayList object to hold the lines of input file














Notepad++ sort column by length