From: daz Date: 2003-08-06T13:41:14+09:00 Subject: [OT] Re: What's New and Shiny in Ruby 1.8.0? "Harry Ohlsen" wrote: > > #=> ["dog", "fox", "the", "the", "lazy", "over", "brown", "jumps", "quick"] > It doesn't roll off the tongue like the original IMHO :) but you may be the first person to discover programmatically that there's a redundant word in there. In response to this crisis, I offer: 'Quick dogs jump over the lazy brown fox' > Ie, we now have the values sorted first by their length, > and when the length is the same, they're sub-sorted by the > text itself. I think that's great! Agreed. That *is/will be* bl**dy useful. > > I just love Ruby! > It's okay :) daz -- text = ['the quick brown fox jumped over the lazy dog', 'the quick brown fox jumps over the lazy dog', 'quick dogs jump over the lazy brown fox'] text.each do |phr| puts; p phr z = ('a'..'z').to_a - phr.split('') puts " ... doesn't contain \"#{z}\"" unless z.empty? end #->"the quick brown fox jumped over the lazy dog" #-> ... doesn't contain "s"