From: 12 34 Date: 2007-07-02T01:06:29+09:00 Subject: Re: Test equality of each element in an array yermej@gmail.com wrote: > On Jun 30, 11:00 pm, 12 34 wrote: >> I want to see if any element of an array is equal to a file extension >> > > I would use Array's include? method: > > ext_not_to_move = ['jpg', 'pdf', 'mrw'] > if ext_not_to_move.include? File.extname(fn).downcase > # do stuff > end > > And use downcase so you don't have to include variations of each > extension (jpg, JPG, jpG, etc.). > > Jeremy Thanks everyone for the suggestions. Jeremy's appeals to me because it's the most direct. I looked at include, but didn't realize exactly how it works. Thanks for the downcase reminder. I had tried .any, but may not have had it all there. Great community. -- Posted via http://www.ruby-forum.com/.