如何在特定条件之后忽略解析其余的csv文件?

时间:2016-01-07 15:09:06

标签: java

我正在解析一个csv文件,该文件有点像这样

$(document).ready(function() {
 $('input[type="checkbox"]').click(function() {
   var total = 0;
   //var item = [];
   var $parent = $(this).closest('ul');
   $parent.find('input:checked').each(function() {
      total += parseInt($(this).val());
      //item.text();
   });
   $parent.find('span[class^=total]').html(total + ' €');

   var overallPrice = 0;
   $('span[class^=total]').each(function() {
     overallPrice += parseInt($(this).html().replace(' €',''));
   });
   $('.overallprice').html(overallPrice)
   //$('.overallprice').append(item);
   });
});

我的问题是我如何忽略在此特定行之后解析文件" 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 --------- ---------- ----------- "

我正在阅读csv文件,如下所示

Some Other third Quote

你能告诉我如何解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

您可以检查每一行的子字符串,并在满足特定条件时跳出循环

//inside the  loop    
if (line.contains("some_string"))
  break;