Read a CSV file and Split the Data using JAVA
It will read a CSV file from a particular path and split the data stored in the CSV file
About the Project
This code reads a CSV file line by line and uses StringTokenizer to split the lines with a "|" Delimiter
The libraries used are:
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
The following line describes the path of the csv file and the delimiter by which the string needs to be splitted.
List trends = obj.readFile(Paths.get("C:\\test\\sample.csv"), "|");
Project Files
/
Loading...
| .. | ||
| This directory is empty. | ||