-
-
Save RainerW/1006757 to your computer and use it in GitHub Desktop.
Convert a CSV file into another CSV format.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CsvSplit | |
{ | |
public static void main(String[] args) throws Exception | |
{ | |
FileWriter out = new FileWriter("output.csv"); | |
BufferedReader in = new BufferedReader(new FileReader("input.csv")); | |
String line; | |
while ((line = in.readLine()) != null) | |
{ | |
String[] fields = line.split(";"); | |
String name = fields[2]; | |
String firstname = fields[1]; | |
String kto = fields[3]; | |
String blz = fields[4]; | |
String amount = fields[5]; | |
out.append(String.format("%s;%s %1$s;%s;%s;%s%n", name, firstname, kto, blz, amount)); | |
} | |
out.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment