I would like to know how I have to proceed to read a file in CSV with Java and skip a comma of separation between each field. Read each space that is found but I want it to be each comma (,) how could I do it?
This is my code:
class Pruebas {
public static void main(String [] args) {
String cadena = "MetroBikeShare_2016_Q3_trips.csv";
String elemento=null;
boolean seguir = true;
Scanner entrada = null;
try {
entrada = new Scanner(new File(cadena));
}
catch (FileNotFoundException fnE) {
System.out.println(fnE.getMessage());
seguir = false;
}
if (seguir) {
entrada.nextLine();
while (entrada.hasNext()) {
elemento=entrada.next();
System.out.println(elemento);
}
}
}
}