I am trying to match one or more keywords within a string (str), but I have no luck. My method below is trying to match all keys when I only needed to match any (one or more).
@str = "g stands for girl and b is for boy"
def key1
%w[a, b, c, d, f, g]
end
def result
if @str.include?( key1 )
puts "happy days"
else
puts "bad days"
end
end
puts result # => bad days
How to make it show "happy days"?
PS: I have no idea what to name this title to. Maybe a mod could rename it?
@strhas any of the letters inkey1?