Comparing two lines or objects and getting the difference back

I would like to implement a version history type on my website, and I need a way to compare the strings or keys of objects. For instance:

Original string / object: Fast brown fox

Revised line / object key: Fast brown fox jumped through a lazy rabbit

Version: added jumped over lazy rabbit deleted er

I would like to keep only the revision in my story. I don’t know where to start, so any ideas on how to make me go or give advice on this approach will be really appreciated.

I am aware of find () , and I suspect that this is the best candidate to use, but I don’t know how to visualize this as a solution, because it compares the “wholesale” strings, so to speak.

+3
source share
3 answers

( ), . - - NP . diff-match-patch, JavaScript Java (demo) . HTML, daisydiff , HTML/XML, - (. , ).

, GNU diff, Java ( "GNU Diff Java" ). , diff-match-patch (dmp), dmp, , , , (, ), GNU, , .

+7

.

+1

, this? , , , , , , , Java ( ). .

+1

All Articles