0

Suppose that I have two String with Java source code of the same file, but different versions. Is there an easy way to compare the two files and highlighting in some way the differences? It would be great if I can use JaxMeJS, because I already use it for parsing the String.

1 Answer 1

1

Here is an approach that might work for you: http://www.discursive.com/books/cjcook/reference/manipulate-text-sect-string-diff. It uses the Apache Commons Lang library to provide an edit distance (StringUtils.getLevenshteinDistance) between strings, print out the differences (StringUtils.difference), and the index of the differences (StringUtils.indexOfDifference).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.