Below is my Java code. I'm passing a CSV file and reading the record. I want to split the records by "," and store it into an array. I don't know how to do that. If someone can give me idea about that. I'm pretty new to Java.
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class parser
{
public static void main(String[] args) throws IOException
{
FileReader fileReader = new FileReader(new File("//Users//Desktop//npi.csv"));
BufferedReader br = new BufferedReader(fileReader);
String line = null;
//String[] value = line.split(",");
/*ArrayList list = new ArrayList(Arrays.asList(line));
System.out.println(list);*/
int count = 0;
while((line = br.readLine()) != null)
{
for(int i=0; i < line.length();i++)
{
}
count ++;
System.out.println("Record Count : "+count);
System.out.println(line);
}
}
}
An example of String from the CSV file
See Question&Answers more detail:os"1234567","1","","","","ALI","DONALDSON","","DR.","","O.D.","","","","","","","","","","140-6002 SIT RD","STE A","EVANSVILLE","IN","8418996408","US","6013857469","9586771232","140-6002 SIT RD","SUITE A","EVANSVILLE","IN","770155917","US","6969551228","2403884068","04/13/2003","02/21/2018","","","","M","","","","","","142K01234Z","5376UD","IN","Y","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","980230944","03","IN","","WR09447","01","IN","","12532T","02","IN","GROUP","245699532","08","IN","","3HDPTO","09","IN","INDIVIDUAL","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","X","","","","","","","","","","","","","","","","","","","","",""