Hi and happy new year everyone!
I'm working with a csv file which looks like this:
orange | red blue | green red | red brown | brown yellow | black grey | pink My goal is scanning every row and check if each pair is made of the same item or not.
I'd like to print the total number of rows having different items.
In this case we have 4.
And I'd like also to print which row contains them, with its respective number.
In this case:
1 orange red 2 blue green 5 yellow black 6 grey pink I've searched for similar questions here, but all I could find was about multiple csv files.
I'm using Java... from what I've understood so far, a good start would be:
Scanner scanner = new Scanner(new File("path to my csv file")); scanner.useDelimiter(";"); while(scanner.hasNext()){ // comparing items in rows } scanner.close(); I don't know what to do in the while loop now.
Many thanks!
;as the delimiter would help reading lines and splitting them using the|separator.;to split each line.