Re: return string that is the difference between two other strings
Re: return string that is the difference between two other strings
- Subject: Re: return string that is the difference between two other strings
- From: Jens Alfke <email@hidden>
- Date: Sat, 20 Sep 2014 20:58:56 -0700
> On Sep 20, 2014, at 7:54 PM, 2551 <email@hidden> wrote:
>
> OK, I should have presented the problem, rather than a solution that needed improving. If you have two text files written out at different times, how do you guys determine the difference between their contents to produce a third file stating the changes?
See what I wrote earlier about diff algorithms. (To see them in action, use the 'diff' command in your favorite version control tool, like git or svn.) However, these tend to be either line- or byte-oriented; I'm not sure what there is that operates on word boundaries.
The thing you're looking for doesn't seem very useful, to be honest. If I want to know the difference between two versions of something, I don't think I'd find a randomly-ordered pile of words useful. What I'd want is something that shows the combined text with the deleted words crossed out and the new words highlighted. That's basically a diff. The implementation is completely different from what you're doing, because order matters; it has to scan both arrays of words in parallel and notice the changes (and beyond that, I don't know any further details. I'm sure it's covered in textbooks.)
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden