Link to home
Start Free TrialLog in
Avatar of philipleighs
philipleighs

asked on

Text comparison

Hi all.

Has anyone had to put a differencing engine into their apps? That's what I'm faced with. Part of the app records a history of small snippets of text (3k or so on average) that are held in a database. I need to be able to visually compare the text.

Something like WinDiff, VisualDiff, or the GNU diff engine or whatever, but I want to incorporate the engine into a Delphi app (or talk to a COM obj would be fine) so that I can present the results in my own format.

Anyone know of such a library?

Thanks,
Phil.
Avatar of AvonWyss
AvonWyss
Flag of Switzerland image

Shall it be line-based? In this case, it's not that hard to write for yourself. Just compare two lines (let's call the A and B), if they are the same, go to the next pair. If they differ, search the A line in the next N (where N is the maximal edit distance) lines of B. If not found, skip to the next A, etc. Doing this, you'll resync (when you find matching line pairs) or you will eventually come to file end.
Avatar of aikimark
DLSuperC now has a way to invoke it with command line parameters, so you could display the results after it did its comparison.  It is very thorough and fast.

You can contact Don Ludlow (dlsuperc.com), the DLSuperC developer, about features you might need.  He's pretty responsive to feature requests.  He wrote this in Delphi.
ASKER CERTIFIED SOLUTION
Avatar of TOndrej
TOndrej

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of philipleighs
philipleighs

ASKER

TOndrej,

The component uses the Eugene Myers routine which is what I was hoping for.

I've looked at the code and it's suitable for my purposes.

Thanks,
Phil.