-1

I am parsing a csv file and the file will be somewhat like this

07-Jan-2016
It is better to lead from behind and to put others in front, especially when you celebrate victory when nice things occur. You take the front line when there is danger. Then people will appreciate your leadership.

The main thing that you have to remember on this journey is, just be nice to everyone and always smile.

Some Other third Quote 

and some all content here goes on 
---------
----------
-----------

My question is how can i ignore parsing file after this particular line "Some Other third Quote "

I am reading the csv file as shown below

 String csvFile = "ip/ASRER070116.csv";
  BufferedReader br = null;
  String line = "";
  try {
   br = new BufferedReader(new FileReader(csvFile));
   while ((line = br.readLine()) != null) {
    System.out.println(line);
   }
  } 

Could you please tell me how to resolve this ??

Pawan
  • 31,545
  • 102
  • 256
  • 434
  • 2
    These questions may help you: [How do I compare strings in java?](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java) - [How do I exit a while loop in java?](http://stackoverflow.com/questions/7951690/how-do-i-exit-a-while-loop-in-java) – BackSlash Jan 07 '16 at 15:10
  • 3
    You could always `break` to stop your while loop – randrade86 Jan 07 '16 at 15:11

1 Answers1

1

You can check every line for a substring and break out of the loop when a particular condition is met

//inside the  loop    
if (line.contains("some_string"))
  break;
dsp_user
  • 2,061
  • 2
  • 16
  • 23