Problem
Work on a database assignment in Java and struggling with separating my data.
I have been given several CSV files, one of which is a list of movies. They are separated as listed below:
1::Toy Story (1995):: Animated | Family
My job is to extract the data from each and upload to an SQL server where I will then run queries. However, before I upload it, I need to separate my data. For example, my professor wants the year and movie in a separate column, and we need to avoid repeating groups for genres meaning. I need to extract the genre from my initial movies CSV and create a separate table with a movie/genre relationiship.
I've already created an array which stores all the data from the Movies CSV, however I'm struggling with getting the (1995) into a separate array as well as the genres. I've read a lot about regex and pattern matching but I can't seem to get anything to work. Here's what I've been attempting:
for(int i = 1; i < movies.length;){
years = movies[i].split("");
i = i + 3;
}
}
I increment i by 3 as the element with the movie title comes on every 3rd after element 1. Any tips are greatly appreciated!