Skip to content

Instantly share code, notes, and snippets.

@dan-dm
Created May 16, 2020 14:40
Show Gist options
  • Save dan-dm/cd7fa922c6af0fd360cf54629d3ae6c8 to your computer and use it in GitHub Desktop.
Save dan-dm/cd7fa922c6af0fd360cf54629d3ae6c8 to your computer and use it in GitHub Desktop.
Created with Copy to Gist
// we create a scanner for reading the file
try (Scanner scanner = new Scanner(Paths.get("henkilot.csv"))) {
// we read all the lines of the file
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
// if the line is blank we do nothing
if (line.isEmpty()) {
continue;
}
// do something with the data
}
} catch (Exception e) {
System.out.println("Error: " + e.getMessage());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment