Meaning I would compare words and their index in an array of words created from 
the two strings. The first mismatch is easily found, but the tricky part is 
finding the last one. Here a context driven comparison may help. Instead of 
comparing word N in both strings, you compare words N and N-1, taking into 
consideration the number of extra words found in previous iterations. I have 
not tested this specific case, but can tell you context driven may help. All 
depends on whether you need the actual difference returned. If not, life is 
easy :-)

Verstuurd vanaf mijn iPhone

> Op 21 sep. 2014 om 08:24 heeft Diederik Meijer | Ten Horses 
> <diede...@tenhorses.com> het volgende geschreven:
> 
> I do a lot of text data mining and need similar functions a lot. I would 
> start on a word by word level, to have whatever it returns be more meaningfull
> 
> Verstuurd vanaf mijn iPhone
> 
>>> Op 20 sep. 2014 om 19:43 heeft Scott Ribe <scott_r...@elevated-dev.com> het 
>>> volgende geschreven:
>>> 
>>> On Sep 20, 2014, at 11:13 AM, 2551 <2551p...@gmail.com> wrote:
>>> 
>>> For example:
>>> 
>>> NSString *mary = @"mary had a little lamb, a little lamb she had";
>>>  NSString *scary = @"mary had a little lamb, a little naughty fella of a 
>>> lamb she had for sure";
>>>  NSString *isDifferent = [self getDifference:mary and: scary];
>>>  NSLog(@"%@", isDifferent);
>>> 
>>> The method I posted below produces the difference that I want ("naughty 
>>> fella of a for sure"). But I want to know if there's a more orthodox and 
>>> robust solution.
>> 
>> That's not even remotely close to a definition of what you mean. What about:
>> 
>> @"mary had a little lamb, a little naughty lamb she had"
>> 
>> vs
>> 
>> @"mary had a little lamb, a little fella of a lamb she had for sure"
>> 
>> ?
>> 
>> Or:
>> 
>> @"mary had a little lamb, a naughty little lamb she had"
>> 
>> vs
>> 
>> @"mary had a big lamb, a little fella of a lamb she had for sure"
>> 
>> There is no simple definition of "the difference between two strings", and I 
>> don't think it's a basic need at all.
>> 
>> -- 
>> Scott Ribe
>> scott_r...@elevated-dev.com
>> http://www.elevated-dev.com/
>> (303) 722-0567 voice
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> 
>> 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/diederik%40tenhorses.com
>> 
>> This email sent to diede...@tenhorses.com
> 
> _______________________________________________
> 
> 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/diederik%40tenhorses.com
> 
> This email sent to diede...@tenhorses.com

_______________________________________________

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

Reply via email to