Ruby是否在字符串数组中的字符串中等于一个字符串?

问题描述:

有没有简单的方法来调用类似于数据库的东西在查询中?Ruby是否在字符串数组中的字符串中等于一个字符串?

是否 “MyString的” 在[ “字符串1”, “MyString的”, “字符串2”] =>存在将返回true

是否 “MyString的” 在[ “字符串1”, “字符串2” 存在 “STRING3” ] =>将返回false

["string1","mystring","string2"].include? "mystring" 

参见:Enumerable#include?