Re: Search using a list of words

Tech-Archive recommends: Fix windows errors by optimizing your registry



"Flintstone" <ratcliffe_mike@xxxxxxxxxxx> wrote in message
news:1182938498.674186.144760@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I am looking for a way to search a project using a list of
words (contained in a file) and display a list of the words
I have not used. I want to search a whole project (stored
locally) and find out which words from the list I have not
used. So if my project contained the words txtString1 and
txtEnglish3 then the utility should output txt2. Does anybody
know of an existing utility that can accomplish this?

You've already got such a utility. It is called VB6. All your main projects
files contain standard Ascii text and so it would be very easy to load them
into a String in VB and use the Instr function to search that string for
each of the 8000 words in your list and flag up those that it doesn't use
(which will probably be quite a lot of them!). Since you're checking against
up to 8000 different words then it would probably be best to convert the
string containing the loaded project file to upper case and to have your
list of search words also in upper case. That will allow you to use
BinaryCompare instead of TextCompare and would speed it up a lot (unless of
course case sensitivity is important to you for some reason). You would need
to check the characters immediately before and immediately after the "found
word" of course to ensure that it was not part of a longer word (checking
perhaps for a comma or a space or a CrLf) but that wouldn't slow it down
very much. Even such a simple solution using Instr would be quite fast, and
you would probably be able to process even a fairly large set of project
files (50K or so) in a couple of seconds even with your long list of 8000
words to check. You could no doubt speed this up further by loading the file
into a Byte array instead of a String and searching through the raw byte
data using standard integer comparisons, which would allow you to use a more
efficient search algorithm than the one used by Instr, but I don't think
you'll need to go to all that trouble and I think you'll find Instr fast
enough for your needs.

Mike





.



Relevant Pages

  • RE: How can I create a outlook appointment item from data in a e-m
    ... If you know the starting point of where the text you want occurs, use InStr ... Eric Legault (Outlook MVP, MCDBA, MCTS: ... if I have a string that looks like this: ... Once you get the text you need, it's easy to create a new appointment item: ...
    (microsoft.public.outlook.program_vba)
  • Parsing a string
    ... The function also has two optional input parameters, ... default delimiter value in the function definition line ... then using the instr() functions. ... Dim ArrayBreakPosAs Integer, strPrefix As String ...
    (microsoft.public.access.queries)
  • Re: Using TComPort
    ... I've just started using Dejan Crnila's TComPort version 2.64 with a tiny ... All you need to do is 'parse' the input string, ... instr = instr+RxChar; ... (The web address for the microprocessor system is below if you are ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Match text - case sensitive
    ... InStr uses a binary comparison by default. ... String expression being searched. ...
    (microsoft.public.scripting.vbscript)
  • Re: How to use the UNIX command: tr
    ... > "Does anyone know how to convert a lower case string to upper case ... > Which ignores the OPs question, even though the poster is obviously ... I'm sorry, that is my response, taken out of context. ...
    (comp.unix.solaris)