is there any other simple,nicer
way?
require 'pp'
a1 = ["02/28/10","Webinars","131","0","26 Feb 2010","0","3d, 8h, 49m, 18s"]
a2 = ["02/20/10","Webinars","131","9","26 Feb 2010","0","3d, 8h, 49m, 18s"]
def compare(array1,array2,ignore)
tmp1 = Array.new
tmp2 = Array.new
0.upto(array1.length-1) {|index|
if !ignore.include?(index)
tmp1 << array1[index]
tmp2 << array2[index]
end
}
if tmp1 == tmp2
return true
else
return false
end
end
pp a1
pp a2
puts
puts compare(a1,a2,[0,3])
and the output is
["02/28/10", "Webinars", "131", "0", "26 Feb 2010", "0", "3d, 8h, 49m, 18s"]
["02/20/10", "Webinars", "131", "9", "26 Feb 2010", "0", "3d, 8h, 49m, 18s"]
true