From: nobu.nokada@... Date: 2002-11-27T20:30:31+09:00 Subject: Re: set operation Hi, At Wed, 27 Nov 2002 20:18:15 +0900, Tim Bates wrote: > > if ([string] & array_of_strings).length!=0 then.... > > I don't know what 'in' is used for, but another way to do this might be > if [array_of_strings].index(myString) then... Or: array_of_strings.include?(myString) If array_of_strings is large and invariant, you may want to prepare a hash whose keys are the elements. hash_of_srings = {} array_of_strings.each {|s| hash_of_srings[s] = true} ... if hash_of_srings[myString] Array#index and Array#include? are O(n) order but Hash#[] is O(1). -- Nobu Nakada