Dim dic As new Dictionary(of String,String)
Dim dicfile As String = Forms("窗口1").Controls("TextBox2").value
Dim Book As New XLS.Book(dicfile)
Dim Sheet As XLS.Sheet = Book.Sheets(0)
For i As Integer = 0 To Sheet.Rows.Count-1
If dic.ContainsKey(Sheet(i, 0).Text) = False Then
dic.add(Sheet(i, 0).Text,Sheet(i, 1).Text)
End If
Next
If dic.ContainsKey(Sheet1(i, j).Text) Then
Sheet1(i, j).Value = Sheet1(i, j).Text & "|" & dic(Sheet1(i, j).Text)
end if
字典:键为:BUS BAY 值为:巴士站
需要匹配的EXCEL文件内容为:
1行1列:BUS BAY
2行1列:Bus BAY
3行1列:bus bay
只有1行1列的那个全部大写的(BUS BAY)能匹配上,其他小写及大小写混合的就匹配不上
问:字典如何忽略大小写?使以上3行内容全部匹配?