Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 166
  • Last Modified:

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.
0
philipleighs
Asked:
philipleighs
1 Solution
 
AvonWyssCommented:
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.
0
 
aikimarkCommented:
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.
0
 
philipleighsAuthor Commented:
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.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now