Advertisement
Guest User

Untitled

a guest
Feb 20th, 2018
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. String [] col;
  2. String fmt = "%-10s %5s";
  3. try
  4. {
  5. File inFile = new File ("c:\\temp\\as1datafile.csv");
  6. Scanner myData = new Scanner(inFile);
  7. FileWriter fw = new FileWriter("c:\\temp\\AS1Result.txt",true);
  8. PrintWriter pw = new PrintWriter(fw);
  9.  
  10. while (myData.hasNextLine())
  11. {
  12. col = myData.nextLine().split(",");
  13. System.out.println(String.format(fmt,
  14. col[0],col[3]));
  15. pw.println(String.format(fmt,
  16. col[0],col[3]));
  17. }
  18. myData.close();
  19. pw.close();
  20. }
  21. catch (Exception ex)
  22. {
  23. System.out.print(ex.getMessage());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement