1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| Dim sr As New StreamReader("C:\Users\...\fichier.txt")
Dim contains As String = sr.ReadToEnd
Dim tab() As String = contains.Split(" ")
Dim res As String
Dim res1 As String
Dim path1 As String = "C:\Users\...\" & i & "fichier2.txt"
Dim sr2 As New StreamReader(path1, Encoding.UTF8)
Dim container As String = sr2.ReadToEnd
Dim tab1() As String = container.Split(" ")
Dim sw As StreamWriter = New StreamWriter("C:\Users\......\resultat.txt")
Dim v As Integer = 0
Dim w As Integer = 0
While v < UBound(tab) 'And w < UBound(tab1)
If tab(v) = tab1(w) Then
Dim empl As Long = InStr(tab(v), "/")
res &= vbCrLf & "+1 " & (Mid(tab(v), empl + 1) + Chr(32))
sw.WriteLine(res)
If v < UBound(tab) Then
v = v + 1
End If
If w < UBound(tab1) Then
w = w + 1
End If
While tab(v) = tab1(w)
Dim empl2 As Long = InStr(tab(v), "/")
res &= Mid(tab(v), empl2 + 1) + Chr(32)
sw.WriteLine(res)
If v < UBound(tab) Then
v = v + 1
End If
If w < UBound(tab1) Then
w = w + 1
End If
End While
Else
Dim empl As Long = InStr(tab(v), "/")
res1 &= vbCrLf & "-1 " & Mid(tab(v), empl + 1) + Chr(32)
sw.WriteLine(res1)
If v < UBound(tab) Then
v = v + 1
End If
While tab(v) <> tab1(w)
Dim empl1 As Long = InStr(tab(v), "/")
res1 &= Mid(tab(v), empl1 + 1) + Chr(32)
sw.WriteLine(res1)
If v < UBound(tab) Then
v = v + 1
End If
End While
End If
End While
sr.Close()
sr2.Close()
sw.Close() |
Partager