On 21 Sep 2014, at 02:56, Ludovic Nicolle <lnico...@chezludo.com> wrote:
> Once we (and maybe yourself? :p ) know what you truly want 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? (You can assume they are plain text and contain nothing other than the traditional ASCII 128 character set). That's all I'm trying to achieve. For my use case, order can be ingored, but case sensitive differences and repeats must be counted as unique instances. Thus, if String A = @"Happy Birthday to You Happy Birthday to You Happy Birthday Dear Mary"; //Happy = 3, Birthday = 3, to = 2, You = 2, Dear = 1, Mary = 1 String B = @"Happy Birthday Dear Mary and you too Scary"; //Happy = 1, Birthday = 1, Dear = 1; Mary = 1, and = 1, you = 1, too = 1, Scary = 1 The result should be the subtraction of the word counts, returning: result = @"Happy Birthday to You Happy Birthday to You and you too Scary; //Happy = 2, Birthday = 2, to =2, You = 2, and = 1, you =1, too =1, Scary = 1 Just to sum up, the suggestions I've had so far are to look at CFStringTokenizer (Thanks, Kyle) NSLinguisticTagger (Thanks, Gerd) and NSMutableSet -minusSet: or -intersectSet (Gerd, again). I did look at -minusSet before setting out to reinvent the wheel (rather squarely) using a convoluted implementation of NSArray's removeObject. but I overlooked -intersectSet. I'll look again. Thanks for the help so far. Best
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com