Coding a string.include? any_item_in[array] to avoid a loop

with a string like : subpart.content_type = “video/mp4; name=tom1-
short.mp4”
is there anyway to avoid a loop in checking if this string contains
one of the extension in an array [‘mp4’, ‘m4v’, ‘mov’]

something like :

subpart.content_type.include_one_of_them? [‘mp4’, ‘m4v’, ‘mov’]

thanks for you suggestions

erwin

I can make it work but I have to write a loop

On 9 February 2011 12:29, Erwin [email protected] wrote:

with a string like : subpart.content_type = “video/mp4; name=tom1-
short.mp4”
is there anyway to avoid a loop in checking if this string contains
one of the extension in an array [‘mp4’, ‘m4v’, ‘mov’]

something like :

subpart.content_type.include_one_of_them? [‘mp4’, ‘m4v’, ‘mov’]

You can use a regular expression. Google ruby regular expressions if
you do not know how.

Colin