package ReaderCSV;
import java.util.*;
public class Main
{
public static void main(String[] args)
{
System.out.println("CSV READER");
System.out.println("--------------------------------------");
System.out.print("Enter name of file .csv: ");
String nameFile = new Scanner(System.in).nextLine();
java.io.InputStreamReader myfile;
String cadena;
int position;
try
{
myfile = new java.io.InputStreamReader(nameFile, System.Text.Encoding.Default);
String line;
do
{
line = myfile.ReadLine();
if ((line != null) && (!line.equals("")))
{
try
{
line = line.replace("\"", "");
position = line.indexOf(';');
cadena = line.substring(0, position);
line = tangible.StringHelper.remove(line, 0, position + 1);
System.out.println(cadena + "\n");
position = line.indexOf(';');
cadena = line.substring(0, position);
line = tangible.StringHelper.remove(line, 0, position + 1);
System.out.println(cadena + "\n");
position = line.indexOf(';');
cadena = line.substring(0, position);
line = tangible.StringHelper.remove(line, 0, position + 1);
System.out.println(cadena + "\n");
cadena = line.substring(0);
System.out.println(cadena + "\n");
}
catch (RuntimeException e)
{
System.out.println("Error !!! " + e.getMessage());
}
}
} while (line != null);
}
catch (RuntimeException e)
{
System.out.println("Error !!!" + e.getMessage());
}
}
}