java - How to Check for empty line while parsing csv file? -
from third party daily reports getting similar kind of csv file shown below
07-jan-2016 better lead behind , put others in front, when celebrate victory when nice things occur. take front line when there danger. people appreciate leadership. main thing have remember on journey is, nice , smile.
my requirement need put each paragraph (a line after space) each quote above reference in separate stringbuffer
my question how can check empty line ??
i tried
if(line.contains(" ")) { system.out.println("hjjjjjjjjjjjjjjjjk"); }
but above causing issue ever there space
i reading csv file shown below
string csvfile = "ip/asrer070116.csv"; bufferedreader br = null; string line = ""; try { br = new bufferedreader(new filereader(csvfile)); while ((line = br.readline()) != null) { if (line.startswith(",")) { line = line.replacefirst(",", ""); } system.out.println(line); } }
could please tell me how resolve ??
if (line != null && (line.trim().equals("") || line.trim().equals("\n"))){ system.out.println("this empty line"); }
Comments
Post a Comment