Hi, I am looking for advice on the best way to achieve my current goal.
I am reading a textfile and extracting information from each line. For example string1 and string2. I am then writing these string to a datatable.
However, sometimes there will be repeats in string1 and string2.
If there are repeated lines I would like to be able to delete the repeating line and add a counter to find the total number of repeating lines.
so if a string repeates 3 times I would like there to be a column with a 3 displayed next to the line in my datatable.
If anyone has any suggestion on the best approach or some example code I would very much appreciate this.


Re: Summing lines in a text file 80 80

I'm comparing two arrays of strings. If string 2 matches string 1 more than once then I delete the repeating strings in both. I then add a counter to see how many times the matches appear.

string1 string2
apple orange
apple banana
apple pear
mango banana
mango banana

I only want to delete the second occurence of mango banana. I then need a total count of mango banana (2).

Re: Summing lines in a text file 80 80

I've added the strings to a datatable and am going to loop through the datatable to do this search. If anyone has any example about comparing and declaring a previous and current row in a datatable I would appreciate it.

Re: Summing lines in a text file 80 80

Problem solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.