Reading a CSV File Into a 2D String Array Using Java

Veröffentlicht am: 14 Oktober 2022
auf dem Kanal: Max O'Didily
6,504
95

Reading a CSV File Into a 2D String Array Using Java

Greetings, today I am here with a tutorial on how we can read the contents of a CSV file into a 2D String array using Java. By CSV, I mean a file with the csv format. This does work with .csv files but can also work with other files like .txt or .dat. This can also work with a different delimiter.

Each field of a record/line is going to get its own element in this 2D String array. A record is a collection of fields and a field is a single piece of data in a record. We store 1 record per line in this tutorial.

After we read the data from the file into a 2D String array, we can then do what we want with the data, like sorting it or displaying it.

You can easily change this tutorial to store the data in a multidimensional list, a custom class/data structure system or even a regular String array. I am covering 2D String arrays because of a YouTube comment request and so this video can be a direct follow up.

Here is a tutorial on how to sort a 2D String array:    • Sorting a 2D String Array By Column Using ...  

This tutorial is also great for anyone looking to read the contents of a file into an array.

Thanks for watching this tutorial on reading a csv file into a 2D String array.

Subscribe to keep notified when I upload: https://tinyurl.com/SubMaxODidily

Reading a CSV File Into a 2D String Array Using Java


Auf dieser Seite können Sie das Online-Video Reading a CSV File Into a 2D String Array Using Java mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Max O'Didily 14 Oktober 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 6,504 Mal angesehen und es wurde von 95 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!