|
-
Aug 17th, 2007, 04:27 AM
#1
Thread Starter
Junior Member
Comparing two text files and extracting the unmatched strings
Hi,
In vb.net, how to do a file comparison between two text files and extract out the unmatched string...
I've done the following comparison.. very basic one...
Private Function FileCompare(ByRef NewFile As Array, ByRef OldFile As Array) As String
Dim intI As Integer
Dim strNew, strOld, strTemp As String
Dim intposition As Integer
Dim strchar As String
For intI = LBound(OldFile) To UBound(OldFile)
strOld = OldFile(intI)
If (strOld <> "" And strOld <> " ") Then
intposition = 0
For Each strchar In NewFile
If (strchar <> "" And strchar <> " ") Then
intposition = InStr(strOld, strchar)
If (intposition = 0) Then
strTemp = strTemp & "," & strchar
Else
Exit For
End If
End If
Next
End If
Next
Return strTemp
End Function
But the drawback is,, the strTemp starts to have the first record onwards.. not the unmatched strings...
Any heads up will be much appreciated..
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|