There are about 4 million records, record every string length is 40 digital characters, has now asked if two public substring of string length range of more than 10, the output of this two strings, but is it so hard to find a half day a Stupid, my way is to put all the characters in an array, and then processing, and can have a better way
CodePudding user response:
That sounds like the combination of two exhaustive comparison, can't think out what else the efficient way to 4 million bytes, 40 amounted to less than 200 m, read into the memory should not have what problem,
CodePudding user response:
Google suffix array dynamic programming LCS Thinking is all the strings in the suffix array, and then sorted VB does not support pointer, to implement the efficiency is very low,
CodePudding user response:
This test is that better?
The Public Function CompStr (Str1 As String, Str2 As String, Optional ByVal Length As Integer=10) As a Boolean 'Str1 Str2 need to compare two strings 'Lenght matching measures, longer than the output of the Lenght true, otherwise false Dim I As an Integer, subStr As String For I=1 To Len (Str1) - Length SubStr=Mid (Str1, I, Length + 1) If InStr Str2, subStr () & gt; 0 Then the Exit For Next CompStr=CBool (I & lt; Len (Str1) - Length) End the Function
CodePudding user response:
"All the characters into an array" this have what use? If it is all "string", that is should, But it must be line memory is not big enough, Single is 40 character data, this article 400 w Have more than 320 MB of space, If the free memory is not enough, you will be transferred to the exchange area, Your "data load" process could be very long,
"Half a day to find a", maybe your search method is not right, You'd better use some instance data, To explain what "meet", what kind of do not conform to,