> can somebody help me to find a free Diff library? I would like to compare
> texts and figure out the different lines but also differences in the lines.
1) GIYF
2) For what programmatic purpose? Various command-line utilities
exist that can do this sort of thing for you; perhaps you could use
them for your purpose.

Signature
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
> Hi,
>
> can somebody help me to find a free Diff library? I would like to compare
> texts and figure out the different lines but also differences in the lines.
>
> Zsolt
I have written a Diff implementation, along with a viewer that displays
the differences either inline (with colour highlighting) or side by side
(also with highlighting).
You can get the bits from my WebScarab repository at:
Diff class:
<http://dawes.za.net/gitweb.cgi?p=dawes.za.net/rogan/webscarab/webscarab.git;a=bl
ob;h=52f44b0f1912a67810498778fe3aa4b52ae8de64;hb=373301b0048c43dfacd1c7965f13bf8
cccd7d317;f=src/org/owasp/webscarab/util/Diff.java>
DiffPanel class:
<http://dawes.za.net/gitweb.cgi?p=dawes.za.net/rogan/webscarab/webscarab.git;a=bl
ob;h=539ef5537f9f00d70c4df7c801c0a24704038776;hb=373301b0048c43dfacd1c7965f13bf8
cccd7d317;f=src/org/owasp/webscarab/util/swing/DiffPanel.java>
NoWrapEditorKit class: (used by DiffPanel.class)
<http://dawes.za.net/gitweb.cgi?p=dawes.za.net/rogan/webscarab/webscarab.git;a=bl
ob;h=1977dd8611e3333437f5436afe5be545d6749488;hb=373301b0048c43dfacd1c7965f13bf8
cccd7d317;f=src/org/owasp/webscarab/util/swing/NoWrapEditorKit.java>
These classes are part of a larger program, so you will need to edit
package names, etc to suit.
There are a couple of examples showing how to use it in the DiffPanel
main method.
The diff algorithm is O(m*n) where m and n are the length of the 2
source documents. Obviously, the longer the documents, the longer it is
going to take. One approach to reduce n and m by tokenising the source
documents, typically along line or word boundaries.
So, what you can do is the following:
// get the edits by line
List edits = Diff.getEdits(src, dst, '\n');
// refine the edits to get the minimum edits
edits = Diff.refine(src, dst, edits);
// show the differences visually
panel.showDifferences(src, dst, edits);
Code is licensed under the GPL.
Let me know if you have any questions. Or any improvements . . . ;-)
Rogan