更新时间:2022-11-17 10:37:33
the_string =~ /fwd:|fw:/i
你也可以使用类似的东西
You could also use something like
%w(fwd: fw:).any? {|str| the_string.downcase.include? str}
尽管我个人更喜欢在这种情况下使用正则表达式的版本(特别是因为您必须在第二个中调用 downcase 以使其不区分大小写).
Though personally I like the version using the regex better in this case (especially as you have to call downcase in the second one to make it case insensitive).