From: Trans Date: 2006-09-03T04:25:57+09:00 Subject: Re: Ordered contrast for String or Array James Edward Gray II wrote: > On Sep 2, 2006, at 12:10 PM, Trans wrote: > > > I have two strings: "aabc" and "aacd". I want to get an "ordered > > contrast" to see the difference in their spellings. Eg. > > > > "aabc".ordered_contrast( "aacc" ) => " cc" > > I assume that's an error. The last to letters match. It's correct. By "ordered" I mean by sort order (ie. alphabetic) so "aabc" and "aacc" diverge at the thrid letter. Regular, unordered "contrast" doesn't care about that and would blank the last letter too. > Also, how are you determining which letter to show for the contrast? If they are != or == and in the same position. Hmmm.. maybe the Array form would be a better example: [ "a", "a", "b", "c" ].contrast => [ nil, nil, "b", nil ] [ "a", "a", "b", "c" ].ordered_contrast => [ nil, nil, "b","c" ] [ "a", "a", "b", "c" ].intersect => [ "a", "a", nil, "c" ] [ "a", "a", "b", "c" ].ordered_intersect => [ "a", "a", nil, nil ] Also, maybe the terms 'negative' and 'positive' would have been better than 'contrast' and 'intersect'. T.