I have a csv file that contains german car license plates. The structure is as follows: B,Berlin, Germany the first one B is the first capital letter of the city, the second position is the City, and the third position is the state
I only want the first two positions, only B and Berlin
I know how to read a CSV File in Java, but I don't know how I can tell the compiler to "ignore" the third position?
public void read(){
InputStream inputStream = getResources().openRawResource(R.raw.carplates);
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
try {
String csvLine;
while ((csvLine = reader.readLine()) != null) {
String[] row = csvLine.split(",");
for(int i=0; i<row.length;i++){
Log.d("ROWS", row[i]);
}
}
The output is an Array that contains B, Berlin and Germany. Since there are 400 plates, it is impossible to delete manually the state in the csv file. What is the trick here?
Thank you in advance
[CLEARING]
all the elements are in the same line: B,Berlin,Germany,M,Munich,Germany...