0

I have the following data in a CSV file:

video1duration,video2duration,video3duration
00:01:00, 00:00:24, 00:00:15
00:01:00, 00:00:24, 00:00:15
00:01:00, 00:00:24, 00:00:15

The file is stored in a folder locally in my computer. I need help with writing code to do the followings: - pass the path of the CSV file to access its data, then treat the data as actual data and then validate each cell/value against expected data that will be written in the IDE as follows:

video1duration,video2duration,video3duration
00:02:00, 00:05:24, 00:00:15
00:04:00, 00:10:24, 00:00:15
00:01:00, 00:00:24, 00:00:15
1
  • If anyone can solve it in other programming language it will still work. Your assistance will be very much appreciated. Commented Aug 7, 2019 at 0:52

1 Answer 1

1

As I understand your question, you have two-stage process. Trying to merge these two separate things into one will certainly result in less legible and harder-to-maintain code (everything as one giant package/class/function).

Your first stage is to import a .csv file and parse it using any of these 3 methods: Using java.util.Scanner Using String.split() function Using 3rd Party libraries like OpenCSV

It is possible to validate that your .csv is valid, and that it contains tabular data without knowing or caring about what the data will later be used for.

In the second stage take tabular data (e.g. an array of arrays) and turn it into a tree. At this point, your hierarchy package will be doing validation but it will only be validating the tree structure (e.g. every node except the root has one parent, etc.). If you want to delve further this might be interesting: https://www.npmjs.com/package/csv-file-validator.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.