10-04-18, 07:41 PM
كود :
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim firstFile As String = "D:\aaa.txt"
Dim secondFile As String = "D:\bbb.txt"
Dim firstFile_st As String = IO.File.ReadAllText(firstFile)
Dim secondFile_st As String = IO.File.ReadAllText(secondFile)
Dim words_firstFile() As String
Dim words_secondFile() As String
'Dim counter_word() As Integer
words_firstFile = Split(firstFile_st, " ")
words_secondFile = Split(secondFile_st, " ")
Dim counter As Integer = 0
For i As Integer = 0 To words_firstFile.Length - 1
For j As Integer = 0 To words_secondFile.Length - 1
If words_firstFile(i) = words_secondFile(j) Then
counter = counter + 1
End If
Next
Next
End Sub