Topic: Problem with array

I have an array like this:
array = [ "manyThings.mp3", "myLike.gif", "moreCoco.bmp",

and I want to make some comparison to eliminate all the words in the
array that are NOT of the bmp format.  So at the end the array will look
like this:

array = ["moreCoco.bmp", "theFormat.bmp"]

is there a way to do this???

Many thanks for the help

Re: Problem with array { |a| a =~ /\.bmp$/ }

Or make it more readable using the Rails ends_with? method: { |a| a.ends_with?('.bmp') }

Rob Anderton

Re: Problem with array

I'm fairly new to Ruby but I have to say things like the Array select and map are real time savers. … s_sel.html