3 Replies Latest reply: Feb 9, 2009 12:08 PM by camickr RSS

    Reading empty lines in a .csv file

    807588
      Hi All,

      I need to know the line no of the data entered in the .csv file.
      My input.csv will look like this,

      1
      2
      3
      4
      5 a,b,c,45,78
      6 1,78,c,e,90
      7
      My code is,

      // Reading all the lines from the input file
      BufferedReader inputFile = new BufferedReader(new FileReader("input.csv"));
      for (int i = 1; (str = inputFile.readLine()) ! = null; i++) {
      sop("Line no" + i + " " + str);
      }

      My expectation is,
      5 a,b,c,45,78
      But the actual result coming is,
      1 a,b,c,45,78
      I need to know at what exact line the data is entered ? Could you pls help me out ?
      Thanks in Advance.