def sub_search
@my_params=[['a','b','c'],['a','q','e'],['b','e','h']]
check_params=[]
@page_params=[]
if @my_params.size>0
@my_params.each do |x|
unless check_params.include?(x[0])
check_params<<x[0]
@tag=1
end
@page_params<<x if @tag==1
@tag=0
end
end
end
p @page_params #=>[['a','b','c'],['b','e','h']]
数组中根据某元素去重
最新推荐文章于 2023-07-19 11:29:01 发布