I have CSV file to read , and i am storing in string and i need to split string at every "," and my input will be like
Name, Id, Description, emailId Micheal,234655,"Test description for the next line issue Thanks and Regards,Mike",Mike@yahoo.com
Kindly help me with this.
Regards, Vijay
enter code here
import java.io.*;
import java.util.logging.*;
import java.util.ArrayList;
import java.util.List;
public class ReadingCSVFile {
public static void main(String args[])
{
StringBuilder sb =new StringBuilder();
int n;
String inputStream;
String Name[] =new String[30];
List l1 = new ArrayList();
try
{
FileInputStream fis =new fileInputStream("C:/Users/vijaykumar.naga/Desktop/Abc.txt");
FileOutputStream fos = new FileOutputStream("C:/Users/vijaykumar.naga/Desktop/Output.txt");
int ch;
while((ch = fis.read()) != -1){
sb.append((char)ch);
}
System.out.println("The InputString is " +sb.toString());
String abcd =sb.toString();
for(int i=0; i<30; i++)
{
l1.add(abcd.split(","));
System.out.println("The Names are " +l1);
}
}
catch(Exception e)
{
}
}
}