hi,
I was trying to get the record which contains null word between comma from text file and printing to log file
for example :
paris,, America, Spain, Japan
india,Srilanka,Pakistan,Bangladesh
I will get the output in log: Paris, ,America, Spain, because getting null between comma below is my code .
from code i dont understand why array not detecting null eventhough i have split with (,).
pls help me out .
What I have tried:
while((s = sr.readLine())!= null){
PrintStream p = new PrintStream(Log_file);
String a[]= s.split(",");
// System.out.println(s);
//System.out.println(a[5]);
for(String k:a)
{
if(k !=null)
{
//System.out.println(a[i]);
if(a[i] ==null){
p.println(s);