Home > Software engineering >  For the most in the history of the fastest TXT text contrast excluding statements
For the most in the history of the fastest TXT text contrast excluding statements

Time:11-01

Demand is very simple, is A text delete B text in the same line, and each line according to the former only 11 more, as long as the same before 11 just delete the entire line, before humanmagic great god provides the following statement, delete the similar record speed are ok, but millions of half A day to run the level not to come out, I generally is 5 million to 10 million levels, on hand have A small internal use of vb program, two 5 million level can eliminate TXT ten minutes or so complete, but the function is not applicable, suffer from cannot find the source code, can't, for which people have faster logic,
Sub demo ()
Dim d As Object, temp As String
The Set d=CreateObject (" scripting. The dictionary ")
Open "C: \ Users \ delete set. TXT" For Input As # 1
The Line Input # 1, temp
Do Until EOF (1)
The Line Input # 1, temp
D (Left (temp, 11))=""
Loop
Close # 1
Open "C: \ Users \ source data. TXT" For Input As # 1
Open "C: \ Users \ results. TXT" For the Output As # 2
The Line Input # 1, temp
Print # 2, temp
Do Until EOF (1)
The Line Input # 1, temp
If Not d.e xists (Left (temp, 11)) Then
Print # 2, temp
End the If
Loop
Close # 1, # 2
End Sub
  •  Tags:  
  • VBA
  • Related