My string is
str = "my string is this one"
and my array is
arr = ["no", "nothing", "only", "is"]
So, my string includes the is in the value of my array, I want to get the result true
How can I do this?
I want to use include? met
This uses a Regular expression. The good news is that it is generated for you - no syntax to learn. Other good news: it traverses the string only once.
re = Regexp.union(arr) #your own regular expression without screws or bolts
p re.match?(str) # => true
str = "not"; arr = ["no"] should not match. (Easy fix, nice approach.)