我正在尝试编写一个从单词列表中删除单词的应用程序:
puts "Words:"
text = gets.chomp
puts "Words to remove:"
remove = gets.chomp
words = text.split(" ")
removes = remove.split(" ")
words.each do |x|
if removes.include.upcase? x.upcase
print "REMOVED "
else
print x, " "
end
end
我如何使这种情况不敏感?我试着放在.upcase
那里,但没有运气。