Hi all 
I am trying to read from a file, this file has empty lines, I want to skip 
empty lines and go to next line
My code is 

-----------------------------------------------------------
 
     public void run()
     {
         
        String myFile = "/home/joseph/myFile.csv";
    BufferedReader br = null;
    String line = "";
    String splitBy = ",";
        Integer useridno = 0;
        try {
 
      br = new BufferedReader(new FileReader(csvFile));
      while ((line = br.readLine()) != null) {
          
         
//          if (line.indexOf( splitBy)>0)
//          {
//            useridno= useridno +1 ; 
//              System.out.println("The Line have details and line no is " 
+ useridno);
//            String[] field = line.split(splitBy);
//       
//          }
          
          
        // use comma as separator
     String[] field = line.split(splitBy);
            
                 useridno= useridno +1 ; 
                 System.out.println("UserDi is  " + useridno);
 
        }
 
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        if (br != null) {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
 
    System.out.println("Done");
  }
----------------------------------------------------------------------------------------------

-- 
You received this message because you are subscribed to the Google Groups 
"JPassion.com: Java Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/jpassion_java.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to