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.


6 Years
Discussion Span
Last Post by starlight849

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).

Edited by starlight849: n/a


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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.