我有兩個二維陣列,比較二維陣列
a = [[17360, "Z51.89"],
[17361, "S93.601A"],
[17362, "H66.91"],
[17363, "H25.12"],
[17364, "Z01.01"],
[17365, "Z00.121"],
[17366, "Z00.129"],
[17367, "K57.90"],
[17368, "I63.9"]]
和
b = [[17360, "I87.2"],
[17361, "s93.601"],
[17362, "h66.91"],
[17363, "h25.12"],
[17364, "Z51.89"],
[17365, "z00.121"],
[17366, "z00.129"],
[17367, "k55.9"],
[17368, "I63.9"]]
我想在兩個陣列來計算類似的行,而不管字符案件,即"h25.12"
將等於"H25.12"
。
我試過,
count = a.count - (a - b).count
但(a - b)
收益
[[17360, "Z51.89"],
[17361, "S93.601A"],
[17362, "H66.91"],
[17363, "H25.12"],
[17364, "Z01.01"],
[17365, "Z00.121"],
[17366, "Z00.129"],
[17367, "K57.90"]]
我需要算作5
因爲有5個類似的行,當我們不考慮字符大小寫。
爲什麼選擇近距離投票? – 2015-03-25 06:39:08
這些不是二維數組,Ruby沒有這種東西(除非你想要計算Matrix),那些數組就是數組。 – 2015-03-25 06:47:33
好的!這意味着按照慣例,Ruby沒有「二維數組」? – 2015-03-25 07:03:13