Link to home
Start Free TrialLog in
Avatar of AndyC1000
AndyC1000

asked on

Reading file skip header

Dear all,

I want to skip the first line (header) when reading a file.  I've placed checks in previous code,  if value of the cell matches the string ignore, however in this case there are too many columns.

See below code block.

Thanks

File f = new File(filename);
Scanner sc = new Scanner(f);

while (sc.hasNextLine()) {
  String line = sc.nextLine();
  String[] details = line.split(",");
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of mccarl
mccarl
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial