urgent help needed - diff between arrays
Posted: Mon Sep 29, 2003 5:46 am
Hello all,
I need to make an intelligent diff between 2 arrays.
this arrays contain lines from files and I need to compare them line by line.
I have built a diff that goes line by line and if the line is matches -ok ,but if the line is misplaced then it come out with the line number that there is a match.
The problem is that one array may have a bunch of lines that doesn't exsist on the other array - in this case I have many lines that are misplaced (from that point and on) and what I need to do is to display these lines as missing but when they sync up again the display should be equal.
Example
array 1: sunday,monday,tuesday,friday,saturday
array 2:sunday,monday,tuesday,wednesday,thursday,friday,saturday
now my display is this (in 2 frames side by side)
sunday sunday
monday monday
tuesday tuesday
friday wednesday (missing)
saturday thursday (missing)
friday (misplaced)
saturday(misplaced)
of course the arrays can be much longer and identical from thsi point on but my diff shows that there are many differences when actually there are only 2.
and what I need to display is:
sunday sunday
monday monday
tuesday tuesday
wednesday (missing)
thursday (missing)
friday friday
saturday saturday
I hope all is understood....
Thanks
I need to make an intelligent diff between 2 arrays.
this arrays contain lines from files and I need to compare them line by line.
I have built a diff that goes line by line and if the line is matches -ok ,but if the line is misplaced then it come out with the line number that there is a match.
The problem is that one array may have a bunch of lines that doesn't exsist on the other array - in this case I have many lines that are misplaced (from that point and on) and what I need to do is to display these lines as missing but when they sync up again the display should be equal.
Example
array 1: sunday,monday,tuesday,friday,saturday
array 2:sunday,monday,tuesday,wednesday,thursday,friday,saturday
now my display is this (in 2 frames side by side)
sunday sunday
monday monday
tuesday tuesday
friday wednesday (missing)
saturday thursday (missing)
friday (misplaced)
saturday(misplaced)
of course the arrays can be much longer and identical from thsi point on but my diff shows that there are many differences when actually there are only 2.
and what I need to display is:
sunday sunday
monday monday
tuesday tuesday
wednesday (missing)
thursday (missing)
friday friday
saturday saturday
I hope all is understood....
Thanks