【发布时间】:2012-09-14 19:32:22
【问题描述】:
假设我有这个数组:
array = ["str1", "str2", "str3", "str4", "str5", "str6", "str7", "str8"]
我在做什么:
array.delete_if {|i| i == "str1" || i == "str3" || i == "str5"}
我明白了:
["str2", "str4", "str6", "str7", "str8"]
在 ruby 中有没有更好的方法来做到这一点?
【问题讨论】: